Sha256: 1857fb8c351de18fecf7312090a0fbe0680103708c38d58df79e3ec39b830ba7

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

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

class TestPageObject
  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 TestPageObject do |page|
      page.should be_instance_of TestPageObject
    end
  end
  
  it "should create and visit a new page" do
    @world.browser.should_receive(:goto)
    @world.visit_page TestPageObject do |page|
      page.should be_instance_of TestPageObject
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
page-object-0.1.1 spec/page-object/page_factory_spec.rb
page-object-0.1 spec/page-object/page_factory_spec.rb
page-object-0.0.5 spec/page-object/page_factory_spec.rb