Skip to content

Commit 93596bf

Browse files
committed
deduplicate test textx in api docs specs
1 parent 6d8b176 commit 93596bf

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

spec/features/api_docs/index_spec.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,32 @@
4444
context "with authenticated user" do
4545
current_user { create(:user) }
4646

47+
let(:api_docs_text) { "OpenProject API V3 (Stable)" }
48+
let(:root_text) { "OpenProject community" }
49+
4750
it "displays the docs rendered by openapi-explorer" do
4851
visit_docs_page
4952

5053
# web component are harder to test with capybara
51-
expect(find("openapi-explorer").shadow_root).to have_css("#api-title", text: "OpenProject API V3 (Stable)")
54+
expect(find("openapi-explorer").shadow_root).to have_css("#api-title", text: api_docs_text)
5255
end
5356

5457
it "doesn't change the path to base url" do
5558
visit_docs_page
56-
expect(page).to have_text "OpenProject API V3 (Stable)"
59+
expect(page).to have_text api_docs_text
5760

5861
expect(page).to have_current_path("#{api_docs_url}#?route=overview") # fragment is added
5962
end
6063

6164
it "allows navigating back to docs" do
6265
visit_docs_page
63-
expect(page).to have_text "OpenProject API V3 (Stable)"
66+
expect(page).to have_text api_docs_text
6467

6568
click_link "Home"
66-
expect(page).to have_no_text "OpenProject API V3 (Stable)"
69+
expect(page).to have_no_text api_docs_text
6770

6871
page.go_back
69-
expect(page).to have_text "OpenProject API V3 (Stable)"
72+
expect(page).to have_text api_docs_text
7073
end
7174

7275
context "when APIv3 documentation is disabled (from Administration > API > Enable docs page)",

0 commit comments

Comments
 (0)