Sha256: 35d019b105212f1171c5354eb9eb7f611b65beb29c56645257fb7aec5f54534d

Contents?: true

Size: 848 Bytes

Versions: 9

Compression:

Stored size: 848 Bytes

Contents

require 'spec_helper'

describe Wombat::Property::Locators::Html do
	it 'should locate html property' do
		fake_elem = double :element
		context   = double :context
		fake_elem.stub inner_html: "Something cool "
		context.stub(:xpath).with("/abc", nil).and_return [fake_elem]
		property = Wombat::DSL::Property.new('data1', 'xpath=/abc', :html)

		locator = Wombat::Property::Locators::Html.new(property)

		locator.locate(context).should == { "data1" => "Something cool" }
	end

	it 'should return null if the property cannot be found' do
		fake_elem = double :element
		context   = double :context
		context.stub(:xpath).with("/abc", nil).and_return []
		property = Wombat::DSL::Property.new('data1', 'xpath=/abc', :html)

		locator = Wombat::Property::Locators::Html.new(property)

		locator.locate(context).should == { "data1" => nil }
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wombat-2.4.0 spec/property/locators/html_spec.rb
wombat-2.3.0 spec/property/locators/html_spec.rb
wombat-2.2.1 spec/property/locators/html_spec.rb
wombat-2.2.0 spec/property/locators/html_spec.rb
wombat-2.1.3 spec/property/locators/html_spec.rb
wombat-2.1.2 spec/property/locators/html_spec.rb
wombat-2.1.1 spec/property/locators/html_spec.rb
wombat-2.1.0 spec/property/locators/html_spec.rb
wombat-2.0.1 spec/property/locators/html_spec.rb