Check table rows content instead of database
Checking the database with methods like Activity.last does not test that the record is present where it should be (first record of the table in this case). In these tests there's only one record, though, so the order doesn't matter that match. However, calling methods like Activity.last generates a database query after the process running the browser has been started, and this might lead to inconsistent data.
This commit is contained in:
@@ -303,9 +303,16 @@ describe "System Emails" do
|
||||
|
||||
visit admin_system_email_preview_pending_path("proposal_notification_digest")
|
||||
|
||||
expect(Notification.count).to equal(1)
|
||||
expect(Activity.last.actionable_type).to eq("ProposalNotification")
|
||||
expect(page).to have_content("Proposal B")
|
||||
expect(page).not_to have_content("Proposal A Title")
|
||||
|
||||
visit admin_activity_path
|
||||
|
||||
within first("tbody tr") do
|
||||
expect(page).to have_content "Proposal notification"
|
||||
expect(page).to have_content "Proposal A Title"
|
||||
expect(page).to have_content admin.user.username
|
||||
end
|
||||
end
|
||||
|
||||
scenario "#send_pending" do
|
||||
|
||||
Reference in New Issue
Block a user