DEV: Update specs to avoid dependence on ember-cli build (#24347)

The `src` of js files is now dependent on the ember-cli/webpack build, so it's not a good thing to check in specs. In CI it passes because the ember-cli build is not run. But locally it would fail if you had a build in `app/assets/javascripts/discourse/dist`.

This commit updates the specs to check for the presence of a stable data attribute instead.
This commit is contained in:
David Taylor 2023-11-13 19:26:43 +00:00 committed by GitHub
parent 1dad379412
commit e2e454c480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -10,7 +10,12 @@ RSpec.describe InvitesController do
it "shows the accept invite page" do
get "/invites/#{invite.invite_key}"
expect(response.status).to eq(200)
expect(response.body).to have_tag(:script, with: { src: "/assets/discourse.js" })
expect(response.body).to have_tag(
:script,
with: {
"data-discourse-entrypoint" => "discourse",
},
)
expect(response.body).not_to include(invite.email)
expect(response.body).to_not include(
I18n.t(

View File

@ -2714,7 +2714,7 @@ RSpec.describe TopicsController do
body = response.body
expect(body).to have_tag(:script, src: "/assets/discourse.js")
expect(body).to have_tag(:script, with: { "data-discourse-entrypoint" => "discourse" })
expect(body).to have_tag(:meta, with: { name: "fragment" })
end
@ -3116,7 +3116,7 @@ RSpec.describe TopicsController do
body = response.body
expect(response.status).to eq(200)
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
expect(body).to have_tag(:script, with: { "data-discourse-entrypoint" => "discourse" })
expect(body).to_not have_tag(:meta, with: { name: "fragment" })
end
end
@ -3129,7 +3129,7 @@ RSpec.describe TopicsController do
body = response.body
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
expect(body).to have_tag(:script, with: { "data-discourse-entrypoint" => "discourse" })
expect(body).to have_tag(:meta, with: { name: "fragment" })
end
@ -5162,7 +5162,7 @@ RSpec.describe TopicsController do
body = response.body
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
expect(body).to have_tag(:script, with: { "data-discourse-entrypoint" => "discourse" })
expect(body).to have_tag(:meta, with: { name: "fragment" })
end
end