Sha256: fcecb63ac71ef69d232b83538aff5e267288710cb11253ce64fe30cc3ec2c2be
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
Given /^an object '(.*)'$/ do |name| @movie = Movie.new @movie.title = 'Gone with the Wind' @movie.director = 'Victor Fleming' @movie.writers = ['Sidney Howard'] @director = Director.new @director.name = 'Victor Fleming' @award = AcademyAward.new @award.year = '1940' @award.category = 'Best Director' @director.awards = [@award] @movie.director = @director end Given /^a hash named '(.*)':$/ do |name, table| @all = [] table.hashes.each do |hash| @last = hash.inject({}) do |h, (key, value)| h["#{key.underscore.gsub(' ', '_')}"] = value h end @all << @last end instance_variable_set("@#{name}", @last) end When /^I save the object '(.*)'$/ do |name| object = instance_variable_get("@#{name}") @last_save = @collection.save(object.to_bson) end Then /^the object '(.*)' roundtrips$/ do |name| object = instance_variable_get("@#{name}") object.instance_variable_set("@_id", @last_save) MongoDoc::BSON.decode(@collection.find_one(@last_save)).should == object end Then /^the attribute '(.*)' of '(.*)' is '(.*)'$/ do |attr, var, value| object = instance_variable_get("@#{var}") object.send(attr).to_s.should == value end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongodoc-0.0.0 | features/step_definitions/object_steps.rb |