Sha256: f4a24f4bab0819c7ef53f94f32e017a4ac0909d755678161c8b63b488e6d1869

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

# this file generated by script/generate pickle

# create a model
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
  create_model(name, fields)
end

# create n models
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  count.to_i.times { create_model(plural_factory.singularize, fields) }
end

# find a model
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
  find_model(name, fields).should_not be_nil
end

# find exactly n models
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
  clear_models(plural_factory.singularize)
  find_models(plural_factory.singularize, fields).size.should == count.to_i
end

# assert model is in another model's has_many assoc
Then(/^#{capture_model} should be in #{capture_model}'s (\w+)$/) do |target, owner, association|
  model(owner).send(association).should 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|
  model(owner).send(association).should == model(target)
end

# assert model.predicate? 
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  model(name).should send("be_#{predicate.gsub(' ', '_')}")
end

# assert not model.predicate?
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
  model(name).should_not send("be_#{predicate.gsub(' ', '_')}")
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ianwhite-pickle-0.1.5 rails_generators/pickle/templates/pickle_steps.rb