Sha256: 8bf3234db158a8633c5e12ef1c7b6e2da6f5efe3b36789df0bcacaf809a0cff1

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 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 eq({ "data1" => "Something cool" })
  end

  it 'should return null if the property cannot be found' do
    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 eq({ "data1" => nil })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wombat-3.0.0 spec/property/locators/html_spec.rb
wombat-2.10.0 spec/property/locators/html_spec.rb