Skip to content

Commit

Permalink
Merge pull request consuldemocracy#3797 from consul/use_block_in_travel
Browse files Browse the repository at this point in the history
Use a block to travel in time in specs
  • Loading branch information
javierm committed Oct 24, 2019
2 parents 7e47eb4 + 8f516b9 commit d8136c9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions spec/features/proposal_notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,15 @@

expect(page).to have_content "Your message has been sent correctly."

travel 3.days + 1.second

visit new_proposal_notification_path(proposal_id: proposal.id)
fill_in "Title", with: "Thank you again for supporting my proposal"
fill_in "Message", with: "Please share it again with others so we can make it happen!"
click_button "Send message"

expect(page).to have_content "Your message has been sent correctly."
expect(page).not_to have_content "You have to wait a minimum of 3 days between notifications"

travel_back
travel(3.days + 1.second) do
visit new_proposal_notification_path(proposal_id: proposal.id)
fill_in "Title", with: "Thank you again for supporting my proposal"
fill_in "Message", with: "Please share it again with others so we can make it happen!"
click_button "Send message"

expect(page).to have_content "Your message has been sent correctly."
expect(page).not_to have_content "You have to wait a minimum of 3 days between notifications"
end
end
end
end

0 comments on commit d8136c9

Please sign in to comment.