Extract method to generate app host in tests
On JavaScript tests, Rails URL methods don't include the port when invoked from a test, but they do when invoked from the browser. This was causing some tests to fail with Selenium.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe "System Emails" do
|
||||
describe "System Emails", :js do
|
||||
let(:admin) { create(:administrator) }
|
||||
|
||||
before do
|
||||
@@ -84,10 +84,10 @@ describe "System Emails" do
|
||||
visit admin_system_email_view_path("proposal_notification_digest")
|
||||
|
||||
expect(page).to have_content("Proposal notifications in")
|
||||
expect(page).to have_link("Proposal A Title", href: proposal_url(proposal_a,
|
||||
anchor: "tab-notifications"))
|
||||
expect(page).to have_link("Proposal B Title", href: proposal_url(proposal_b,
|
||||
anchor: "tab-notifications"))
|
||||
expect(page).to have_link("Proposal A Title",
|
||||
href: proposal_url(proposal_a, anchor: "tab-notifications", host: app_host))
|
||||
expect(page).to have_link("Proposal B Title",
|
||||
href: proposal_url(proposal_b, anchor: "tab-notifications", host: app_host))
|
||||
expect(page).to have_content("Proposal A Notification Body")
|
||||
expect(page).to have_content("Proposal B Notification Body")
|
||||
end
|
||||
@@ -102,9 +102,9 @@ describe "System Emails" do
|
||||
expect(page).to have_content "Cleaner city"
|
||||
expect(page).to have_content "Budget for 2019"
|
||||
|
||||
expect(page).to have_link "Participatory Budgets", href: budgets_url
|
||||
expect(page).to have_link "Participatory Budgets", href: budgets_url(host: app_host)
|
||||
|
||||
share_url = budget_investment_url(budget, investment, anchor: "social-share")
|
||||
share_url = budget_investment_url(budget, investment, anchor: "social-share", host: app_host)
|
||||
expect(page).to have_link "Share your project", href: share_url
|
||||
end
|
||||
|
||||
@@ -116,7 +116,7 @@ describe "System Emails" do
|
||||
expect(page).to have_content "Your investment project '#{investment.code}' has been selected"
|
||||
expect(page).to have_content "Start to get votes, share your investment project"
|
||||
|
||||
share_url = budget_investment_url(budget, investment, anchor: "social-share")
|
||||
share_url = budget_investment_url(budget, investment, anchor: "social-share", host: app_host)
|
||||
expect(page).to have_link "Share your investment project", href: share_url
|
||||
end
|
||||
|
||||
@@ -152,7 +152,7 @@ describe "System Emails" do
|
||||
expect(page).to have_content "There is a new comment from #{commenter.name}"
|
||||
expect(page).to have_content comment.body
|
||||
|
||||
expect(page).to have_link "Let's do...", href: debate_url(debate)
|
||||
expect(page).to have_link "Let's do...", href: debate_url(debate, host: app_host)
|
||||
end
|
||||
|
||||
scenario "#reply" do
|
||||
@@ -169,7 +169,7 @@ describe "System Emails" do
|
||||
expect(page).to have_content "There is a new response from #{replier.name}"
|
||||
expect(page).to have_content reply.body
|
||||
|
||||
expect(page).to have_link "Let's do...", href: comment_url(reply)
|
||||
expect(page).to have_link "Let's do...", href: comment_url(reply, host: app_host)
|
||||
end
|
||||
|
||||
scenario "#direct_message_for_receiver" do
|
||||
@@ -179,7 +179,7 @@ describe "System Emails" do
|
||||
expect(page).to have_content "Message's Title"
|
||||
expect(page).to have_content "This is a sample of message's content."
|
||||
|
||||
expect(page).to have_link "Reply to #{admin.user.name}", href: user_url(admin.user)
|
||||
expect(page).to have_link "Reply to #{admin.user.name}", href: user_url(admin.user, host: app_host)
|
||||
end
|
||||
|
||||
scenario "#direct_message_for_sender" do
|
||||
@@ -197,7 +197,7 @@ describe "System Emails" do
|
||||
|
||||
expect(page).to have_content "Confirm your account using the following link"
|
||||
|
||||
expect(page).to have_link "this link", href: email_url(email_verification_token: "abc")
|
||||
expect(page).to have_link "this link", href: email_url(email_verification_token: "abc", host: app_host)
|
||||
end
|
||||
|
||||
scenario "#user_invite" do
|
||||
@@ -257,7 +257,7 @@ describe "System Emails" do
|
||||
expect(page).to have_content comment.body
|
||||
|
||||
expect(page).to have_link "Cleaner city",
|
||||
href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments")
|
||||
href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments", host: app_host)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -277,12 +277,12 @@ describe "System Emails" do
|
||||
visit admin_system_email_preview_pending_path("proposal_notification_digest")
|
||||
|
||||
expect(page).to have_content("This is the content pending to be sent")
|
||||
expect(page).to have_link("Proposal A", href: proposal_url(proposal_a))
|
||||
expect(page).to have_link("Proposal B", href: proposal_url(proposal_b))
|
||||
expect(page).to have_link("Proposal A Title", href: proposal_url(proposal_a,
|
||||
anchor: "tab-notifications"))
|
||||
expect(page).to have_link("Proposal B Title", href: proposal_url(proposal_b,
|
||||
anchor: "tab-notifications"))
|
||||
expect(page).to have_link("Proposal A", href: proposal_url(proposal_a, host: app_host))
|
||||
expect(page).to have_link("Proposal B", href: proposal_url(proposal_b, host: app_host))
|
||||
expect(page).to have_link("Proposal A Title",
|
||||
href: proposal_url(proposal_a, anchor: "tab-notifications", host: app_host))
|
||||
expect(page).to have_link("Proposal B Title",
|
||||
href: proposal_url(proposal_b, anchor: "tab-notifications", host: app_host))
|
||||
end
|
||||
|
||||
scenario "#moderate_pending" do
|
||||
|
||||
Reference in New Issue
Block a user