Merge pull request #4281 from consul/org_name_independent

Make tests independent of the organization name
This commit is contained in:
Javi Martín
2020-12-17 13:33:08 +01:00
committed by GitHub
10 changed files with 19 additions and 0 deletions

View File

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

View File

@@ -48,6 +48,11 @@ describe "Dashboards Rake" do
let!(:action) { create(:dashboard_action, :proposed_action, :active, day_offset: 0) } let!(:action) { create(:dashboard_action, :proposed_action, :active, day_offset: 0) }
let!(:resource) { create(:dashboard_action, :resource, :active, day_offset: 0) } let!(:resource) { create(:dashboard_action, :resource, :active, day_offset: 0) }
before do
Setting["mailer_from_name"] = "CONSUL"
Setting["mailer_from_address"] = "noreply@consul.dev"
end
it " when there are news actions actived for published proposals" do it " when there are news actions actived for published proposals" do
proposal = create(:proposal) proposal = create(:proposal)
action.update!(published_proposal: true) action.update!(published_proposal: true)

View File

@@ -11,6 +11,8 @@ describe Dashboard::Mailer do
before do before do
Setting["feature.dashboard.notification_emails"] = true Setting["feature.dashboard.notification_emails"] = true
Setting["mailer_from_name"] = "CONSUL"
Setting["mailer_from_address"] = "noreply@consul.dev"
end end
describe "#forward" do describe "#forward" do
@@ -165,6 +167,7 @@ describe Dashboard::Mailer do
end end
it "sends emails if new actions detected when creating a proposal" do it "sends emails if new actions detected when creating a proposal" do
Setting["org_name"] = "CONSUL"
action.update!(published_proposal: false) action.update!(published_proposal: false)
resource.update!(published_proposal: false) resource.update!(published_proposal: false)
proposal.save! proposal.save!

View File

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

View File

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

View File

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

View File

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

View File

@@ -239,6 +239,7 @@ describe "Legislation Draft Versions" do
end end
scenario "When page is restored from browser cache do not duplicate annotation handlers" do 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") create(:legislation_annotation, draft_version: draft_version, text: "my annotation")
visit legislation_process_draft_version_path(draft_version.process, draft_version) visit legislation_process_draft_version_path(draft_version.process, draft_version)
@@ -256,6 +257,7 @@ describe "Legislation Draft Versions" do
end end
scenario "When page is restored from browser cache publish comment button keeps working" do 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") create(:legislation_annotation, draft_version: draft_version, text: "my annotation")
visit legislation_process_draft_version_path(draft_version.process, draft_version) visit legislation_process_draft_version_path(draft_version.process, draft_version)

View File

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

View File

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