Sha256: c335b1160b30e1fc58eddecb0106d3516741ad81af1d420e40a17f1099ca304b
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe "Locker" do it "locker file does not exist. create it. mapping should return empty hash" do Watirloo::Locker.mapping.clear FileUtils.rm_f(Watirloo::Locker.locker) if FileTest.exist?(Watirloo::Locker.locker) #remove locker file FileTest.exist?(Watirloo::Locker.locker).should be_false Watirloo::Locker.mapping.should == {} end it "clear should create locker file and save empty mapping" do Watirloo::Locker.clear FileTest.exist?(Watirloo::Locker.locker).should be_true Watirloo::Locker.mapping.should == {} end it 'add stores ie.hwnd with friendly name and adds it to mapping' do ie = Watir::IE.new Watirloo::Locker.add(ie, 'one') Watirloo::Locker.add(ie, 'two') end it 'mapping holds what was added' do Watirloo::Locker.mapping.keys.sort.should == ['one', 'two'] Watirloo::Locker.mapping['one'].should == Watirloo::Locker.mapping['two'] end it 'remove deletes a key value record ' do Watirloo::Locker.remove 'two' Watirloo::Locker.mapping.keys.should_not include('two') end it 'browser reattaches to named browser based on windows handle' do ie = Watirloo::Locker.browser 'one' ie.should be_kind_of(Watir::IE) ie.hwnd.should == Watirloo::Locker.mapping['one'] ie.should exist ie.close ie.should_not exist end it 'browser attach to nonexisting windows behaves like IE.attach, it raises error' do sleep 6 # if previous test closes a browser we need to wait to ensure we don't reattach to a closing browser (lambda {Watirloo::Locker.browser('one')}).should raise_error(Watir::Exception::NoMatchingWindowFoundException) #points to the same hwnd as 'one' but at this time does not exist any more end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
marekj-watirloo-0.0.5 | spec/locker_spec.rb |
watirloo-0.0.8 | spec/locker_spec.rb |
watirloo-0.0.7 | spec/locker_spec.rb |