spec/generators_spec.rb in fluent-0.3.0 vs spec/generators_spec.rb in fluent-0.4.0

- old
+ new

@@ -15,16 +15,11 @@ watir_definition.check_title selenium_browser.should_receive(:title).twice.and_return('Test App') selenium_definition.check_title end - - it 'should specify and verify the page url' do - watir_browser.should_receive(:url).twice.and_return('http://localhost:4567') - watir_definition.check_url - end - + it 'should raise an error if the page title is not verified' do msg = "Expected title: 'Test App'; Actual title: 'Testing'" watir_browser.should_receive(:title).twice.and_return('Testing') expect { watir_definition.check_title }.to raise_error(Fluent::Errors::TitleNotMatched, msg) end @@ -36,33 +31,38 @@ end watir_browser.should_receive(:title).twice.and_return('Symbiote') QuickDefinition.new(watir_browser).check_title end + end + + it 'should specify and verify the page url' do + watir_browser.should_receive(:url).twice.and_return('http://localhost:4567') + watir_definition.check_url + end - it 'should allow frames to act as a context' do - watir_browser.should_receive(:frame).with(id: 'frame').and_return(watir_browser) - watir_browser.should_receive(:text_field).and_return(watir_browser) - web_element = watir_definition.framedName_text_field - web_element.should_not be_nil - web_element.should be_instance_of Fluent::WebElements::TextField - end + it 'should allow frames to act as a context' do + watir_browser.should_receive(:frame).with(id: 'frame').and_return(watir_browser) + watir_browser.should_receive(:text_field).and_return(watir_browser) + web_element = watir_definition.framedName_text_field + web_element.should_not be_nil + web_element.should be_instance_of Fluent::WebElements::TextField + end - context 'automatically looking for an element' do - it 'should specify and verify an expected elements' do - watir_definition.should_receive(:name_object).and_return(watir_browser) - watir_browser.should_receive(:when_present).with(5).and_return(watir_browser) - watir_definition.check_objects + context 'automatically looking for an element' do + it 'should specify and verify an expected elements' do + watir_definition.should_receive(:name_object).and_return(watir_browser) + watir_browser.should_receive(:when_present).with(5).and_return(watir_browser) + watir_definition.check_objects + end + + it 'should raise an error if an expected elements are not verified' do + class QuickDefinition + include Fluent + look_for :fakeLink end - - it 'should raise an error if an expected elements are not verified' do - class QuickDefinition - include Fluent - look_for :fakeLink - end - expect { QuickDefinition.new(watir_browser).check_objects }.to raise_error - end + expect { QuickDefinition.new(watir_browser).check_objects }.to raise_error end end context 'a definition using watir-webdriver' do context 'providing a url' do @@ -80,8 +80,8 @@ selenium_browser.should_receive(:to) selenium_definition.view end end end - + end end \ No newline at end of file