From 14977d726e20f2bd864a28e5f7206f68480a5675 Mon Sep 17 00:00:00 2001 From: Ian White Date: Tue, 24 Nov 2009 16:36:04 +0000 Subject: [PATCH] Make generated pickle steps less picky about possessives, so pickle mapping can work in more situations --- rails_generators/pickle/templates/pickle_steps.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rails_generators/pickle/templates/pickle_steps.rb b/rails_generators/pickle/templates/pickle_steps.rb index 08cf9566..eb1b4017 100755 --- a/rails_generators/pickle/templates/pickle_steps.rb +++ b/rails_generators/pickle/templates/pickle_steps.rb @@ -11,7 +11,7 @@ end # create models from a table -Given /^the following #{capture_plural_factory} exist$/ do |plural_factory, table| +Given /^the following #{capture_plural_factory} exist:?$/ do |plural_factory, table| name = plural_factory.singularize table.hashes.each { |hash| create_model(name, hash) } end @@ -32,22 +32,22 @@ end # assert model is in another model's has_many assoc -Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}'s (\w+)$/) do |target, owner, association| +Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association| model(owner).send(association).should include(model(target)) end # assert model is not in another model's has_many assoc -Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}'s (\w+)$/) do |target, owner, association| +Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association| model(owner).send(association).should_not include(model(target)) end # assert model is another model's has_one/belongs_to assoc -Then(/^#{capture_model} should be #{capture_model}'s (\w+)$/) do |target, owner, association| +Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association| model(owner).send(association).should == model(target) end # assert model is not another model's has_one/belongs_to assoc -Then(/^#{capture_model} should not be #{capture_model}'s (\w+)$/) do |target, owner, association| +Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association| model(owner).send(association).should_not == model(target) end