Sha256: 6860c8e39fdde9113d5461e4cf8978c7c12cd3e0573e0d08d46d85b4aab63d0a

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

blueprint :apple do
  Fruit.create! :species => 'apple'
end

blueprint :many_apples => [:apple, :apple, :apple]

blueprint :bananas_and_apples => :apple do
  @banana = Fruit.create! :species => 'banana'
end

blueprint :orange do
  Fruit.create! :species => 'orange'
end

blueprint :fruit => [:apple, :orange] do
  [@orange, @apple]
end

blueprint :bananas_and_apples_and_oranges => [:bananas_and_apples, :orange] do
  @fruit = [@orange, @apple, @banana]
end

blueprint :cherry do
  Fruit.create! :species => 'cherry', :average_diameter => 3
end

blueprint :big_cherry => :cherry do
  Fruit.create! :species => @cherry.species, :average_diameter => 7
end

blueprint :cherry_basket => [:big_cherry, :cherry] do
  [@cherry, @big_cherry]
end

blueprint :parent_not_existing => :not_existing

Tree.blueprint :oak, :name => 'Oak', :size => 'large'

blueprint :pine do
  @the_pine = Tree.blueprint :name => 'Pine', :size => 'medium'
end

Fruit.blueprint(:acorn, :species => 'Acorn', :tree => :@oak).depends_on(:oak)

namespace :pitted => :pine do
  Tree.blueprint :peach_tree, :name => 'pitted peach tree'
  Fruit.blueprint(:peach, :species => 'pitted peach', :tree => :@peach_tree).depends_on(:peach_tree)
  Fruit.blueprint(:acorn, :species => 'pitted acorn', :tree => :@oak).depends_on(:oak)

  namespace :red => :orange do
    Fruit.blueprint(:apple, :species => 'pitted red apple')
  end
end

blueprint :apple_with_params do
  Fruit.create! options.merge(:species => 'apple')
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blueprints-0.4.2 spec/active_record/blueprint.rb
blueprints-0.4.1 spec/active_record/blueprint.rb
blueprints-0.4.0 spec/active_record/blueprint.rb