Simplify tests checking dates are present
When we create a record like a debate or an event and we check the page content, we want to make sure that today's date is present, since it's the date where the record is supposed to have been created. This way we avoid querying the database after the browser has been started.
This commit is contained in:
@@ -216,7 +216,7 @@ describe "Stats", :admin do
|
||||
end
|
||||
|
||||
context "graphs" do
|
||||
scenario "event graphs" do
|
||||
scenario "event graphs", :with_frozen_time do
|
||||
campaign = create(:campaign)
|
||||
|
||||
visit root_path(track_id: campaign.track_id)
|
||||
@@ -227,9 +227,9 @@ describe "Stats", :admin do
|
||||
end
|
||||
|
||||
expect(page).to have_content "#{campaign.name} (1)"
|
||||
|
||||
within("#graph") do
|
||||
event_created_at = Ahoy::Event.find_by(name: campaign.name).time
|
||||
expect(page).to have_content event_created_at.strftime("%Y-%m-%d")
|
||||
expect(page).to have_content Date.current.strftime("%Y-%m-%d")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user