Sha256: 8a38a4a5cee1c6a68caa57a3879001fab747c32480d5d491a06c12aa829d9682

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

require 'spec_helper'
require 'page-object/page_factory'

class FactoryTestPageObject
  include PageObject
  page_url "http://google.com"
end

class TestWorld
  include PageObject::PageFactory
  
  attr_accessor :browser
end

describe PageObject::PageFactory do
  before(:each) do
    @world = TestWorld.new
    @world.browser = mock_watir_browser
  end
  
  it "should create a new page object and execute a block" do
    @world.browser.should_not_receive(:goto)
    @world.on_page FactoryTestPageObject do |page|
      page.should be_instance_of FactoryTestPageObject
    end
  end
  
  it "should create and visit a new page" do
    @world.browser.should_receive(:goto)
    @world.visit_page FactoryTestPageObject do |page|
      page.should be_instance_of FactoryTestPageObject
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page-object-0.2 spec/page-object/page_factory_spec.rb