Sha256: 50ee6a24ae6169122a03f6dad4996396d16ffa3a306e24b7e398b21fff3df8e4

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Wombat::Property::Locators::Factory do
  it 'should instantiate correct locator according to property type' do
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :text)).should be_a(Wombat::Property::Locators::Text)
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :html)).should be_a(Wombat::Property::Locators::Html)
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :list)).should be_a(Wombat::Property::Locators::List)
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :follow)).should be_a(Wombat::Property::Locators::Follow)
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :iterator)).should be_a(Wombat::Property::Locators::Iterator)
    Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :container)).should be_a(Wombat::Property::Locators::PropertyGroup)
  end

  it 'should raise correct exception if provided property is of unknown type' do
    lambda {
      Wombat::Property::Locators::Factory.locator_for(Wombat::DSL::Property.new(nil, nil, :weird))
    }.should raise_error(Wombat::Property::Locators::UnknownTypeException, "Unknown property format weird.")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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