Sha256: ecfd0363713a07e6737ce6c9a96e8f37988fd1c1d62b3de831dd1a39a9d8f39a

Contents?: true

Size: 966 Bytes

Versions: 17

Compression:

Stored size: 966 Bytes

Contents

require 'spec_helper'

describe Lazyman::Page do
	before :all do
		@app_name = 'test'
		Lazyman::Initializer.new File.dirname(__FILE__), @app_name
	end

	before(:each) do
		@browser = mock_watir_browser
	end
	
	def mock_watir_browser
		watir_browser = double('watir')
		watir_browser.stub!(:is_a?).with(anything()).and_return(false)
		watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
		watir_browser
	end

	it 'method missing' do
		@browser.stub :close
		@browser.should_receive :close
		Lazyman::Page.new(@browser).close
	end

	it 'should turn to page' do
		p = Lazyman::Page.new(@browser).turn_to TestPage
		p.is_a?(TestPage).should be_true
	end

	it 'should data driven with hash' do
		btn = double();
		hash = {:one => 'click', :two => 'ok'}
		
		p = TestPage.new(@browser)
		p.stub(:one).and_return(btn)
		p.stub(:two=)
		btn.should_receive(:click)
		p.should_receive(:one)
		p.should_receive(:two=).with('ok')
		p.data_driven(hash)
	end
	
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
magicspec-0.0.14 spec/lazy_page_spec.rb
magicspec-0.0.11 spec/lazy_page_spec.rb
magicspec-0.0.10 spec/lazy_page_spec.rb
magicspec-0.0.9 spec/lazy_page_spec.rb
magicspec-0.0.8 spec/lazy_page_spec.rb
magicspec-0.0.7 spec/lazy_page_spec.rb
magicspec-0.0.6 spec/lazy_page_spec.rb
magicspec-0.0.5 spec/lazy_page_spec.rb
magicspec-0.0.4 spec/lazy_page_spec.rb
magicspec-0.0.3 spec/lazy_page_spec.rb
magicspec-0.0.2 spec/lazy_page_spec.rb
magicspec-0.0.1 spec/lazy_page_spec.rb
lazyman-0.1.10 spec/lazy_page_spec.rb
lazyman-0.1.9 spec/lazy_page_spec.rb
lazyman-0.1.8 spec/lazy_page_spec.rb
lazyman-0.1.7 spec/lazy_page_spec.rb
lazyman-0.1.3 spec/lazy_page_spec.rb