spec/env_spec.rb in grope-0.1.3 vs spec/env_spec.rb in grope-0.1.4

- old
+ new

@@ -71,9 +71,29 @@ @env.wait(3) (Time.now.to_i - now).should be_close(3, 1) end + it "should wait until given block returns true" do + now = Time.now.to_i + + lambda { + @env.wait_until(:timeout => 1) do |env| + env.document.title == 'xxx' + end + }.should raise_error(Timeout::Error) + + (Time.now.to_i - now).should be_close(1, 1) + + @env.document.querySelector('title').innerHTML = 'xxx' + + result = @env.wait_until do |env| + env.document.title == 'xxx' + end + + result.should be_true + end + it "should use shared cookie storage if 'use_shared_cookie' option is true" do env = Grope::Env.new(:use_shared_cookie => true) env.instance_eval { @resource_load_delegate }.should be_nil end