Don't create content after a visit in notifications test
We forgot to apply this change in commit f5f96ba86.
Note that, in this case, executing `proposal_notification.author.email`
in the middle of a test would also result in a database query. For some
reason (probably the same reason why the code that explicitly created
the author was added in this test but not in other moderation tests),
that doesn't seem to happen in other moderation tests, so for now we
aren't changing those ones.
This commit is contained in:
@@ -52,6 +52,7 @@ describe "Moderate proposal notifications" do
|
||||
describe "moderate in bulk" do
|
||||
describe "When a proposal has been selected for moderation" do
|
||||
let!(:proposal_notification) { create(:proposal_notification, created_at: Date.current - 4.days) }
|
||||
let!(:email) { proposal_notification.author.email }
|
||||
|
||||
before do
|
||||
visit moderation_proposal_notifications_path
|
||||
@@ -66,7 +67,7 @@ describe "Moderate proposal notifications" do
|
||||
expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}")
|
||||
|
||||
click_link "Block users"
|
||||
fill_in "email or name of user", with: proposal_notification.author.email
|
||||
fill_in "email or name of user", with: email
|
||||
click_button "Search"
|
||||
|
||||
within "tr", text: proposal_notification.author.name do
|
||||
@@ -75,15 +76,12 @@ describe "Moderate proposal notifications" do
|
||||
end
|
||||
|
||||
scenario "Block the author" do
|
||||
author = create(:user)
|
||||
proposal_notification.update!(author: author)
|
||||
|
||||
accept_confirm("Are you sure? Block authors") { click_button "Block authors" }
|
||||
|
||||
expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}")
|
||||
|
||||
click_link "Block users"
|
||||
fill_in "email or name of user", with: proposal_notification.author.email
|
||||
fill_in "email or name of user", with: email
|
||||
click_button "Search"
|
||||
|
||||
within "tr", text: proposal_notification.author.name do
|
||||
|
||||
Reference in New Issue
Block a user