Sha256: a5db19e76535ad911ee110bde01ac6f526f5348cdba588651b467152a7cd3462

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

Given /^I have car with brand and colours$/ do
  class Car
    include Dozuki::Mapper
    attr_accessor :brand, :colours
    def initialize
      self.colours = []
    end
  end
end

Given /^I have a colour class with description and hex and a from_node method$/ do
  class Colour
    include Dozuki::Mapper
    attr_accessor :description, :hex
    map_with do |map|
      map.string :description
      map.string :hex
    end
  end
end

When /^I map the car node to a car object with:$/ do |string|
  Car.instance_eval %Q{
    map_with do |map|
      #{string}
    end
  }
  @car = Car.from_node(@doc.get('/car'))
end

Then /^the car should have a brand of "([^"]*)"$/ do |brand|
  @car.brand.should == brand
end

Then /^the car should have a colour with a description of "([^"]*)" and a hex of "([^"]*)"$/ do |description, hex|
  @car.colours.any?{|car| car.description == description && car.hex == hex}.should be_true
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dozuki-mapper-0.1.2 features/step_definitions/each_steps.rb
dozuki-mapper-0.1.1 features/step_definitions/each_steps.rb
dozuki-mapper-0.1.0 features/step_definitions/each_steps.rb
dozuki-mapper-0.0.2 features/step_definitions/each_steps.rb
dozuki-mapper-0.0.1 features/step_definitions/each_steps.rb