spec/browser_spec.rb in page_magic-0.8.9 vs spec/browser_spec.rb in page_magic-0.9.4

- old
+ new

@@ -2,32 +2,36 @@ describe PageMagic::Browser do let(:app) { Object.new } before do - PageMagic::Browser.session = nil + PageMagic::Browser.instance_variable_set(:@session, nil) app.extend PageMagic::Browser end - describe 'page' do - it 'should return the existing session' do - session = double(:session) - PageMagic::Browser.session = session + describe 'default' do + it 'should be firefox' do + PageMagic::Browser.default.should == :firefox + end + end - app.browser.should == session + describe 'browser' do + it 'should return the existing session' do + session_instance = app.browser + app.browser.should == session_instance end it 'should create a session if not already set' do new_session = double(:new_session) - PageMagic.should_receive(:session).with(:chrome).and_return new_session + PageMagic.should_receive(:session).with(:firefox).and_return new_session app.browser.should == new_session end it 'should use custom browser' do - PageMagic::Browser.use :firefox + PageMagic.should_receive(:session).with(:custom_browser) - PageMagic.should_receive(:session).with(:firefox) + PageMagic::Browser.default :custom_browser app.browser end end end \ No newline at end of file