Update travel_to usage
In Rails 5.1, calling `travel_to` inside another `travel_to` block will result in a RuntimeError: > Calling `travel_to` with a block, when we have previously already made > a call to `travel_to`, can lead to confusing time stubbing.
This commit is contained in:
@@ -187,13 +187,10 @@ describe "Voter" do
|
|||||||
expect(page).not_to have_link(answer_yes.title)
|
expect(page).not_to have_link(answer_yes.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
travel_back
|
||||||
|
|
||||||
click_link "Sign out"
|
click_link "Sign out"
|
||||||
|
|
||||||
# Time needs to pass between the moment we vote and the moment
|
|
||||||
# we log in; otherwise the link to vote won't be available.
|
|
||||||
# It's safe to advance one second because this test isn't
|
|
||||||
# affected by possible date changes.
|
|
||||||
travel 1.second do
|
|
||||||
login_as user
|
login_as user
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
@@ -203,7 +200,6 @@ describe "Voter" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Voting in poll and then verifiying account", :js do
|
scenario "Voting in poll and then verifiying account", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ describe Poll::Stats do
|
|||||||
|
|
||||||
expect(stats.version).to eq "v#{time.to_i}"
|
expect(stats.version).to eq "v#{time.to_i}"
|
||||||
|
|
||||||
|
travel_back
|
||||||
|
|
||||||
travel_to 2.seconds.from_now do
|
travel_to 2.seconds.from_now do
|
||||||
expect(stats.version).to eq "v#{time.to_i}"
|
expect(stats.version).to eq "v#{time.to_i}"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user