diff --git a/README.rdoc b/README.rdoc index 87b4a39..c66b557 100755 --- a/README.rdoc +++ b/README.rdoc @@ -37,6 +37,12 @@ You can also refer to the last created object of a kind by saying "above": {Machinist blueprints}[http://github.com/notahat/machinist] and {factory_girl factories}[http://github.com/thoughtbot/factory_girl] will be used when available. +You can use named Machinist blueprint such as Movie.blueprint(:comedy) like this: + + Given a movie (comedy) with the title "Groundhog Day" + +Inherited factory_girl factories are not supported yet. + === Credits Henning Koch diff --git a/cucumber_factory.gemspec b/cucumber_factory.gemspec index 65f4e0f..b7c4bfe 100644 --- a/cucumber_factory.gemspec +++ b/cucumber_factory.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{cucumber_factory} - s.version = "1.3.0" + s.version = "1.3.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Henning Koch"] diff --git a/lib/cucumber_factory/factory.rb b/lib/cucumber_factory/factory.rb index 5d169ce..31108ee 100755 --- a/lib/cucumber_factory/factory.rb +++ b/lib/cucumber_factory/factory.rb @@ -52,7 +52,8 @@ def self.parse_creation(world, raw_model, raw_variant, raw_attributes) association = model_class.reflect_on_association(attribute) if model_class.respond_to?(:reflect_on_association) if association.present? if value_type == "above" - value = association.klass.last or raise "There is no last #{attribute}" + # Don't use class.last, in sqlite that is not always the last inserted element + value = association.klass.find(:last, :order => "id") or raise "There is no last #{attribute}" else value = world.instance_variable_get(variable_name_from_prose(value)) end