Make tests independent of Setting["org_name"]

So tests won't fail when an institution changes the default organization
name.

The tests are also easier to understand now, since it's more obvious
where the "CONSUL" text is coming from.
This commit is contained in:
taitus
2020-11-10 10:59:51 +01:00
committed by Javi Martín
parent 3ce8fa5b95
commit 1a58fcf2a2
9 changed files with 12 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ describe EmailDigest do
let(:user) { create(:user) }
it "delivers email if notifications pending" do
Setting["org_name"] = "CONSUL"
create(:notification, :for_proposal_notification, user: user)
reset_mailer

View File

@@ -165,6 +165,7 @@ describe Dashboard::Mailer do
end
it "sends emails if new actions detected when creating a proposal" do
Setting["org_name"] = "CONSUL"
action.update!(published_proposal: false)
resource.update!(published_proposal: false)
proposal.save!

View File

@@ -80,6 +80,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
end
describe "When restoring the page from browser history" do
before { Setting["org_name"] = "CONSUL" }
scenario "map should not be duplicated", :js do
do_login_for user
visit send(mappable_new_path, arguments)

View File

@@ -201,6 +201,7 @@ describe "System Emails" do
end
scenario "#user_invite" do
Setting["org_name"] = "CONSUL"
visit admin_system_email_view_path("user_invite")
expect(page).to have_content "Invitation to CONSUL"

View File

@@ -250,6 +250,7 @@ describe "Emails" do
context "Proposal notification digest" do
scenario "notifications for proposals that I'm following" do
Setting["org_name"] = "CONSUL"
user = create(:user, email_digest: true)
proposal1 = create(:proposal, followers: [user])
@@ -317,6 +318,7 @@ describe "Emails" do
context "User invites" do
scenario "Send an invitation" do
Setting["org_name"] = "CONSUL"
login_as_manager
visit new_management_user_invite_path

View File

@@ -4,6 +4,7 @@ describe "Help page" do
context "Index" do
scenario "Help menu and page is visible if feature is enabled" do
Setting["feature.help_page"] = true
Setting["org_name"] = "CONSUL"
visit root_path

View File

@@ -239,6 +239,7 @@ describe "Legislation Draft Versions" do
end
scenario "When page is restored from browser cache do not duplicate annotation handlers" do
Setting["org_name"] = "CONSUL"
create(:legislation_annotation, draft_version: draft_version, text: "my annotation")
visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -256,6 +257,7 @@ describe "Legislation Draft Versions" do
end
scenario "When page is restored from browser cache publish comment button keeps working" do
Setting["org_name"] = "CONSUL"
create(:legislation_annotation, draft_version: draft_version, text: "my annotation")
visit legislation_process_draft_version_path(draft_version.process, draft_version)

View File

@@ -193,6 +193,7 @@ describe "Notifications" do
end
it "sends pending proposal notifications" do
Setting["org_name"] = "CONSUL"
Delayed::Worker.delay_jobs = false
Notification.send_pending

View File

@@ -200,6 +200,7 @@ describe "Proposals" do
end
scenario "After using the browser's back button, social buttons will have one screen reader", :js do
Setting["org_name"] = "CONSUL"
proposal = create(:proposal)
visit proposal_path(proposal)
click_link "Help"