test/integration/navigation_test.rb in streamit-0.0.5 vs test/integration/navigation_test.rb in streamit-0.0.6

- old
+ new

@@ -1,36 +1,49 @@ require 'test_helper' class NavigationTest < ActiveSupport::IntegrationCase + + def wait_and_finish + Streamit.finish! + end def register_new_user visit "/users/new" fill_in "Name", :with => "davis" click_button "Create User" + wait_and_finish end - should "fetch recent streams" do + should "fetch limited number of streams" do register_new_user register_new_user - visit "/streamit/fetch" + register_new_user + register_new_user + wait_and_finish + visit "/streamit/fetch?limit=2" assert page.has_selector?("li.stream", :count => 2), "Expected 2 streams, Got:\n#{page.body.inspect}" end should "fetch streams in last ? seconds" do Timecop.freeze(Time.now - 30.seconds) do register_new_user end register_new_user register_new_user + wait_and_finish visit "/streamit/fetch?ago=30" assert page.has_selector?("li.stream", :count => 2), "Expected 2 streams, Got:\n#{page.body.inspect}" end - should "fetch streams from after an id" do + should "fetch limited number of streams in last ? seconds" do + Timecop.freeze(Time.now - 30.seconds) do + register_new_user + end register_new_user register_new_user register_new_user - visit "/streamit/fetch?after=#{Stream.last.id}" + wait_and_finish + visit "/streamit/fetch?ago=30&limit=2" assert page.has_selector?("li.stream", :count => 2), "Expected 2 streams, Got:\n#{page.body.inspect}" end end