Sha256: 007ff02c5029c7a1dbc9416624f6cd97e7a630447ee21ee41b3cc3f07822e9e8

Contents?: true

Size: 879 Bytes

Versions: 6

Compression:

Stored size: 879 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

6 entries across 6 versions & 1 rubygems

Version Path
wombat-2.9.0 spec/property/locators/html_spec.rb
wombat-2.8.0 spec/property/locators/html_spec.rb
wombat-2.7.0 spec/property/locators/html_spec.rb
wombat-2.6.0 spec/property/locators/html_spec.rb
wombat-2.5.1 spec/property/locators/html_spec.rb
wombat-2.5.0 spec/property/locators/html_spec.rb