Skip to content

[#75] Fix a timing bug with poltergeist/turbolinks #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end

def wait_for_turbolinks_to_be_available
sleep(1)
end
4 changes: 4 additions & 0 deletions test/view_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ class ViewHelperTest < ActionDispatch::IntegrationTest
page.execute_script('history.back();')
assert page.has_content?('Hello Alice')

wait_for_turbolinks_to_be_available()

# Try Turbolinks javascript API.
page.execute_script('Turbolinks.visit("/pages/2");')
assert page.has_content?('Hello Alice')

wait_for_turbolinks_to_be_available()

page.execute_script('Turbolinks.visit("/pages/1");')
assert page.has_content?('Hello Bob')

Expand Down