Sha256: aa1df0883589b2208259417a34732b3286b3fb4739ab563880e2a710a64f378a
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' describe Wombat::Property::Locators::Text do it 'should locate text property with xpath selector and namespaces' do fake_elem = double :element context = double :context fake_elem.stub inner_text: "Something cool " context.stub(:xpath).with("/abc", 'boom').and_return [fake_elem] property = Wombat::DSL::Property.new('data1', 'xpath=/abc', :text, 'boom') locator = Wombat::Property::Locators::Text.new(property) locator.locate(context).should == { "data1" => "Something cool" } end it 'should locate text property with css selector' do fake_elem = double :element context = double :context fake_elem.stub inner_text: "My name" context.stub(:css).with("/def").and_return [fake_elem] property = Wombat::DSL::Property.new('data1', 'css=/def', :text) locator = Wombat::Property::Locators::Text.new(property) locator.locate(context).should == { "data1" => "My name" } end it 'should return plain symbols as strings' do fake_elem = double :element context = double :context property = Wombat::DSL::Property.new('data_2', :hardcoded_value, :text) locator = Wombat::Property::Locators::Text.new(property) locator.locate(context).should == { "data_2" => "hardcoded_value" } end it 'should invoke property callback' do fake_elem = double :element context = double :context fake_elem.stub inner_text: "My name" context.stub(:css).with("/def").and_return [fake_elem] property = Wombat::DSL::Property.new('data1', 'css=/def', :text) { |s| s.gsub(/name/, 'ass') } locator = Wombat::Property::Locators::Text.new(property) locator.locate(context).should == { "data1" => "My ass" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wombat-2.0.1 | spec/property/locators/text_spec.rb |
wombat-2.0.0 | spec/property/locators/text_spec.rb |