Sha256: c0f50131ed1d82f961421b8f3348b70ecf8c8101a1fdf38b015913188a404f98

Contents?: true

Size: 1.62 KB

Versions: 12

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe Symbiont::Generators do
  let(:watir_browser) { mock_browser_for_watir }
  let(:watir_definition) { DefinitionTest.new(watir_browser) }

  context "a definition using watir-webdriver" do
    describe "providing a url" do
      it "should navigate to the page when viewed" do
        watir_browser.should_receive(:goto)
        watir_definition.view
      end

      it "should navigate to the page when started" do
        watir_browser.should_receive(:goto)
        watir_definition.start
      end
    end
    
    describe "providing a page title" do
      it "should specify and verify the page title" do
        watir_browser.should_receive(:title).and_return("Title of Page")
        watir_definition.should have_title
      end
      
      it "should raise an error if the page title is not verified" do
        watir_browser.should_receive(:title).twice.and_return("Incorrect Title")
        expect { watir_definition.has_title? }.to raise_error
      end
    end
    
    describe "providing a page object" do
      it "should specify and verify an expected object" do
        watir_definition.should_receive(:testPage_object).and_return(watir_browser)
        watir_browser.should_receive(:when_actionable).with(5).and_return(watir_browser)
        watir_definition.has_object?
      end
      
      it "should raise an error if the page object is not verified" do
        class QuickDefinition
          include Symbiont
          look_for :fakeLink
        end
        QuickDefinition.new(watir_browser).should_not have_object
      end
    end
    
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
symbiont-0.1.9 spec/symbiont/generators_spec.rb
symbiont-0.1.8 spec/symbiont/generators_spec.rb
symbiont-0.1.7 spec/symbiont/generators_spec.rb
symbiont-0.1.6 spec/symbiont/generators_spec.rb
symbiont-0.1.5 spec/symbiont/generators_spec.rb
symbiont-0.1.4 spec/symbiont/generators_spec.rb
symbiont-0.1.3 spec/symbiont/generators_spec.rb
symbiont-0.1.2 spec/symbiont/generators_spec.rb
symbiont-0.1.1 spec/symbiont/generators_spec.rb
symbiont-0.1.0 spec/symbiont/generators_spec.rb
symbiont-0.0.4 spec/symbiont/generators_spec.rb
symbiont-0.0.3 spec/symbiont/generators_spec.rb