fabrication 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +10 -11
 - data/lib/fabrication/errors.rb +2 -0
 - data/lib/fabrication/fabricator.rb +2 -1
 - data/lib/fabrication/support.rb +2 -1
 - data/lib/fabrication/version.rb +1 -1
 - data/spec/{fabricator_spec.rb → fabrication/fabricator_spec.rb} +7 -4
 - data/spec/{generator → fabrication/generator}/active_record_spec.rb +0 -0
 - data/spec/{generator → fabrication/generator}/base_spec.rb +0 -0
 - data/spec/{generator → fabrication/generator}/mongoid_spec.rb +0 -0
 - data/spec/{schematic_spec.rb → fabrication/schematic_spec.rb} +0 -0
 - data/spec/{sequence_spec.rb → fabrication/sequence_spec.rb} +0 -0
 - data/spec/{support_spec.rb → fabrication/support_spec.rb} +4 -1
 - data/spec/fabrication_spec.rb +9 -24
 - data/spec/fabricators.rb +41 -0
 - data/spec/spec_helper.rb +5 -4
 - data/spec/support/active_record.rb +0 -4
 - data/spec/support/helper_objects.rb +0 -18
 - data/spec/support/mongoid.rb +1 -16
 - metadata +15 -14
 - data/spec/spec.opts +0 -3
 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -10,6 +10,14 @@ Currently supported object types are... 
     | 
|
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            By default it will lazily generate active record associations. So if you have a has_many :widgets defined, it will not actually generate the widgets until the association is accessed. You can override this by appending "!" to the name of the parameter when defining the field in the Fabricator.
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
      
 13 
     | 
    
         
            +
            ### Important Thing To Note! ###
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            If you are fabricating an activerecord backed object and it has attributes that are not columns in the underlying table, Fabrication will lazily generate them even if they are not defined associations. You can easily work around this by adding a "!" to the end of the attribute definition in the Fabricator.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Fabricator(:user) do
         
     | 
| 
      
 18 
     | 
    
         
            +
              some_delegated_something_or_other! { Fabricate(:something) }
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       13 
21 
     | 
    
         
             
            ### Installation ###
         
     | 
| 
       14 
22 
     | 
    
         | 
| 
       15 
23 
     | 
    
         
             
            Add this to your gemfile.
         
     | 
| 
         @@ -46,16 +54,6 @@ Breaking down the above, we are defining a "company" fabricator, which will gene 
     | 
|
| 
       46 
54 
     | 
    
         
             
            * After the object is built but before it is saved, it will update the name to "Another Fun Factory".
         
     | 
| 
       47 
55 
     | 
    
         
             
            * After the object is created, it will update the "ceo" association with a new "drone" record.
         
     | 
| 
       48 
56 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
            Alternatively, you can Fabricate(:company) without first defining the Fabricator. Doing so will create an empty Fabricator called ":company" and prevent you from defining the Fabricator explicitly later.
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
            ### Important Thing To Note! ###
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
            If you are fabricating an activerecord backed object and it has attributes that are not columns in the underlying table, Fabrication will lazily generate them even if they are not defined associations. You can easily work around this by adding a "!" to the end of the attribute definition in the Fabricator.
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            Fabricator(:user) do
         
     | 
| 
       56 
     | 
    
         
            -
              some_delegated_something_or_other! { Fabricate(:something) }
         
     | 
| 
       57 
     | 
    
         
            -
            end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
57 
     | 
    
         
             
            ### Inheritance ###
         
     | 
| 
       60 
58 
     | 
    
         | 
| 
       61 
59 
     | 
    
         
             
            So you already have a company fabricator, but you need one that specifically generates an LLC. No problem!
         
     | 
| 
         @@ -64,7 +62,7 @@ So you already have a company fabricator, but you need one that specifically gen 
     | 
|
| 
       64 
62 
     | 
    
         
             
                  type "LLC"
         
     | 
| 
       65 
63 
     | 
    
         
             
                end
         
     | 
| 
       66 
64 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
            Setting the :from option will inherit the class and all the attributes from the named Fabricator. 
     | 
| 
      
 65 
     | 
    
         
            +
            Setting the :from option will inherit the class and all the attributes from the named Fabricator.
         
     | 
| 
       68 
66 
     | 
    
         | 
| 
       69 
67 
     | 
    
         
             
            You can also explicitly specify the class being fabricated with the :class_name parameter.
         
     | 
| 
       70 
68 
     | 
    
         | 
| 
         @@ -136,3 +134,4 @@ To run rake successfully: 
     | 
|
| 
       136 
134 
     | 
    
         
             
            * Dave Ott (daveott)
         
     | 
| 
       137 
135 
     | 
    
         
             
            * Matt (winescout)
         
     | 
| 
       138 
136 
     | 
    
         
             
            * Lar Van Der Jagt (supaspoida)
         
     | 
| 
      
 137 
     | 
    
         
            +
            * Justin Smestad (jsmestad)
         
     | 
    
        data/lib/fabrication/errors.rb
    CHANGED
    
    
| 
         @@ -9,7 +9,8 @@ class Fabrication::Fabricator 
     | 
|
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                def generate(name, options={}, overrides={}, &block)
         
     | 
| 
       11 
11 
     | 
    
         
             
                  Fabrication::Support.find_definitions if schematics.empty?
         
     | 
| 
       12 
     | 
    
         
            -
                   
     | 
| 
      
 12 
     | 
    
         
            +
                  raise Fabrication::UnknownFabricatorError, "No Fabricator defined for '#{name}'" unless schematics.has_key?(name)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  schematics[name].generate(options, overrides, &block)
         
     | 
| 
       13 
14 
     | 
    
         
             
                end
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
                def schematics
         
     | 
    
        data/lib/fabrication/support.rb
    CHANGED
    
    | 
         @@ -23,8 +23,9 @@ class Fabrication::Support 
     | 
|
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                def find_definitions
         
     | 
| 
      
 26 
     | 
    
         
            +
                  base_path = defined?(Rails) ? Rails.root : "."
         
     | 
| 
       26 
27 
     | 
    
         
             
                  ['test', 'spec'].map do |folder|
         
     | 
| 
       27 
     | 
    
         
            -
                    path = File.expand_path(File.join(folder, 'fabricators'))
         
     | 
| 
      
 28 
     | 
    
         
            +
                    path = File.expand_path(File.join(base_path, folder, 'fabricators'))
         
     | 
| 
       28 
29 
     | 
    
         | 
| 
       29 
30 
     | 
    
         
             
                    load("#{path}.rb") if File.exists?("#{path}.rb")
         
     | 
| 
       30 
31 
     | 
    
         | 
    
        data/lib/fabrication/version.rb
    CHANGED
    
    
| 
         @@ -41,19 +41,22 @@ describe Fabrication::Fabricator do 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                  it "finds definitions if none exist" do
         
     | 
| 
       43 
43 
     | 
    
         
             
                    Fabrication::Support.should_receive(:find_definitions)
         
     | 
| 
       44 
     | 
    
         
            -
                    subject.generate(:object)
         
     | 
| 
      
 44 
     | 
    
         
            +
                    lambda { subject.generate(:object) }.should raise_error
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
                context 'with definitions' do
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                  it "raises an error if the  
     | 
| 
       52 
     | 
    
         
            -
                    lambda { subject. 
     | 
| 
      
 51 
     | 
    
         
            +
                  it "raises an error if the class cannot be located" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                    lambda { subject.define(:somenonexistantclass) }.should raise_error(Fabrication::UnfabricatableError)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  it "raises an error if the fabricator cannot be located" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                    lambda { subject.generate(:object) }.should raise_error(Fabrication::UnknownFabricatorError)
         
     | 
| 
       53 
57 
     | 
    
         
             
                  end
         
     | 
| 
       54 
58 
     | 
    
         | 
| 
       55 
59 
     | 
    
         
             
                  it 'generates a new object every time' do
         
     | 
| 
       56 
     | 
    
         
            -
                    subject.define(:person) { first_name '1' }
         
     | 
| 
       57 
60 
     | 
    
         
             
                    subject.generate(:person).should_not == subject.generate(:person)
         
     | 
| 
       58 
61 
     | 
    
         
             
                  end
         
     | 
| 
       59 
62 
     | 
    
         | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -36,7 +36,10 @@ describe Fabrication::Support do 
     | 
|
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
              describe ".find_definitions" do
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                before(:all)  
     | 
| 
      
 39 
     | 
    
         
            +
                before(:all) do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  Fabrication.clear_definitions
         
     | 
| 
      
 41 
     | 
    
         
            +
                  Fabrication::Support.find_definitions
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
       40 
43 
     | 
    
         | 
| 
       41 
44 
     | 
    
         
             
                it "has an awesome object" do
         
     | 
| 
       42 
45 
     | 
    
         
             
                  Fabrication::Fabricator.schematics[:awesome_object].should be
         
     | 
    
        data/spec/fabrication_spec.rb
    CHANGED
    
    | 
         @@ -269,12 +269,16 @@ describe Fabrication do 
     | 
|
| 
       269 
269 
     | 
    
         | 
| 
       270 
270 
     | 
    
         
             
              context 'when defining a fabricator twice' do
         
     | 
| 
       271 
271 
     | 
    
         | 
| 
       272 
     | 
    
         
            -
                 
     | 
| 
       273 
     | 
    
         
            -
                  Fabricator(:author) {}
         
     | 
| 
      
 272 
     | 
    
         
            +
                it 'throws an error' do
         
     | 
| 
      
 273 
     | 
    
         
            +
                  lambda { Fabricator(:author) {} }.should raise_error(Fabrication::DuplicateFabricatorError)
         
     | 
| 
       274 
274 
     | 
    
         
             
                end
         
     | 
| 
       275 
275 
     | 
    
         | 
| 
      
 276 
     | 
    
         
            +
              end
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
              context "when defining a fabricator for a class that doesn't exist" do
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
       276 
280 
     | 
    
         
             
                it 'throws an error' do
         
     | 
| 
       277 
     | 
    
         
            -
                  lambda { Fabricator(: 
     | 
| 
      
 281 
     | 
    
         
            +
                  lambda { Fabricator(:your_mom) }.should raise_error(Fabrication::UnfabricatableError)
         
     | 
| 
       278 
282 
     | 
    
         
             
                end
         
     | 
| 
       279 
283 
     | 
    
         | 
| 
       280 
284 
     | 
    
         
             
              end
         
     | 
| 
         @@ -282,7 +286,7 @@ describe Fabrication do 
     | 
|
| 
       282 
286 
     | 
    
         
             
              context 'when generating from a non-existant fabricator' do
         
     | 
| 
       283 
287 
     | 
    
         | 
| 
       284 
288 
     | 
    
         
             
                it 'throws an error' do
         
     | 
| 
       285 
     | 
    
         
            -
                  lambda { Fabricate(:your_mom) }.should raise_error(Fabrication:: 
     | 
| 
      
 289 
     | 
    
         
            +
                  lambda { Fabricate(:your_mom) }.should raise_error(Fabrication::UnknownFabricatorError)
         
     | 
| 
       286 
290 
     | 
    
         
             
                end
         
     | 
| 
       287 
291 
     | 
    
         | 
| 
       288 
292 
     | 
    
         
             
              end
         
     | 
| 
         @@ -300,30 +304,11 @@ describe Fabrication do 
     | 
|
| 
       300 
304 
     | 
    
         | 
| 
       301 
305 
     | 
    
         
             
              end
         
     | 
| 
       302 
306 
     | 
    
         | 
| 
       303 
     | 
    
         
            -
              describe ".fabricators" do
         
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
                let(:author) { Fabricator(:author) }
         
     | 
| 
       306 
     | 
    
         
            -
                let(:book) { Fabricator(:book) }
         
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
                before(:all) do
         
     | 
| 
       309 
     | 
    
         
            -
                  Fabrication.clear_definitions
         
     | 
| 
       310 
     | 
    
         
            -
                  author; book
         
     | 
| 
       311 
     | 
    
         
            -
                end
         
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
                after(:all) do
         
     | 
| 
       314 
     | 
    
         
            -
                  Fabrication::Support.find_definitions
         
     | 
| 
       315 
     | 
    
         
            -
                end
         
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
       317 
     | 
    
         
            -
                it "returns the two fabricators" do
         
     | 
| 
       318 
     | 
    
         
            -
                  Fabrication::Fabricator.schematics.should == {:author => author, :book => book}
         
     | 
| 
       319 
     | 
    
         
            -
                end
         
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
              end
         
     | 
| 
       322 
     | 
    
         
            -
             
     | 
| 
       323 
307 
     | 
    
         
             
              describe "Fabricate with a block" do
         
     | 
| 
       324 
308 
     | 
    
         | 
| 
       325 
309 
     | 
    
         
             
                let(:person) do
         
     | 
| 
       326 
310 
     | 
    
         
             
                  Fabricate(:person) do
         
     | 
| 
      
 311 
     | 
    
         
            +
                    age nil
         
     | 
| 
       327 
312 
     | 
    
         
             
                    first_name "Paul"
         
     | 
| 
       328 
313 
     | 
    
         
             
                    last_name { "Elliott" }
         
     | 
| 
       329 
314 
     | 
    
         
             
                  end
         
     | 
    
        data/spec/fabricators.rb
    CHANGED
    
    | 
         @@ -1 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Plain Ruby Objects
         
     | 
| 
       1 
2 
     | 
    
         
             
            Fabricator(:awesome_object, :from => :object)
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Fabricator(:dog)
         
     | 
| 
      
 5 
     | 
    
         
            +
            Fabricator(:greyhound, :from => :dog) do
         
     | 
| 
      
 6 
     | 
    
         
            +
              breed "greyhound"
         
     | 
| 
      
 7 
     | 
    
         
            +
              locations(:count => 2)
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Fabricator(:location) do
         
     | 
| 
      
 11 
     | 
    
         
            +
              lat 35
         
     | 
| 
      
 12 
     | 
    
         
            +
              lng 40
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Fabricator(:person) do
         
     | 
| 
      
 16 
     | 
    
         
            +
              first_name "John"
         
     | 
| 
      
 17 
     | 
    
         
            +
              last_name { Faker::Name.last_name }
         
     | 
| 
      
 18 
     | 
    
         
            +
              age { rand(100) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              shoes(:count => 10) { |person, i| "shoe #{i}" }
         
     | 
| 
      
 20 
     | 
    
         
            +
              location
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            # ActiveRecord Objects
         
     | 
| 
      
 24 
     | 
    
         
            +
            Fabricator(:division) do
         
     | 
| 
      
 25 
     | 
    
         
            +
              name "Division Name"
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            # Mongoid Documents
         
     | 
| 
      
 29 
     | 
    
         
            +
            Fabricator(:author) do
         
     | 
| 
      
 30 
     | 
    
         
            +
              name 'George Orwell'
         
     | 
| 
      
 31 
     | 
    
         
            +
              books(:count => 4) do |author, i|
         
     | 
| 
      
 32 
     | 
    
         
            +
                Fabricate(:book, :title => "book title #{i}", :author => author)
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Fabricator(:hemingway, :from => :author) do
         
     | 
| 
      
 37 
     | 
    
         
            +
              name 'Ernest Hemingway'
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            Fabricator(:book) do
         
     | 
| 
      
 41 
     | 
    
         
            +
              title "book title"
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -1,7 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            $:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
         
     | 
| 
       2 
     | 
    
         
            -
            $:.unshift(File.dirname(__FILE__))
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
1 
     | 
    
         
             
            require 'rubygems'
         
     | 
| 
       5 
     | 
    
         
            -
            require ' 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rspec'
         
     | 
| 
       6 
3 
     | 
    
         
             
            require 'fabrication'
         
     | 
| 
       7 
4 
     | 
    
         
             
            require 'ffaker'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # Requires supporting files with custom matchers and macros, etc,
         
     | 
| 
      
 7 
     | 
    
         
            +
            # in ./support/ and its subdirectories.
         
     | 
| 
      
 8 
     | 
    
         
            +
            Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
         
     | 
| 
         @@ -9,21 +9,3 @@ end 
     | 
|
| 
       9 
9 
     | 
    
         
             
            class Person
         
     | 
| 
       10 
10 
     | 
    
         
             
              attr_accessor :age, :first_name, :last_name, :shoes, :location
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            Fabricator(:greyhound, :from => :dog) do
         
     | 
| 
       14 
     | 
    
         
            -
              breed "greyhound"
         
     | 
| 
       15 
     | 
    
         
            -
              locations(:count => 2)
         
     | 
| 
       16 
     | 
    
         
            -
            end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            Fabricator(:location) do
         
     | 
| 
       19 
     | 
    
         
            -
              lat 35
         
     | 
| 
       20 
     | 
    
         
            -
              lng 40
         
     | 
| 
       21 
     | 
    
         
            -
            end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            Fabricator(:person) do
         
     | 
| 
       24 
     | 
    
         
            -
              first_name "John"
         
     | 
| 
       25 
     | 
    
         
            -
              last_name { Faker::Name.last_name }
         
     | 
| 
       26 
     | 
    
         
            -
              age { rand(100) }
         
     | 
| 
       27 
     | 
    
         
            -
              shoes(:count => 10) { |person, i| "shoe #{i}" }
         
     | 
| 
       28 
     | 
    
         
            -
              location
         
     | 
| 
       29 
     | 
    
         
            -
            end
         
     | 
    
        data/spec/support/mongoid.rb
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ def clear_mongodb 
     | 
|
| 
       9 
9 
     | 
    
         
             
              Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
         
     | 
| 
       10 
10 
     | 
    
         
             
            end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
            Rspec.configure do |config|
         
     | 
| 
       13 
13 
     | 
    
         
             
              config.before(:all) do
         
     | 
| 
       14 
14 
     | 
    
         
             
                clear_mongodb
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
         @@ -31,18 +31,3 @@ class Book 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
              embedded_in :author, :inverse_of => :books
         
     | 
| 
       33 
33 
     | 
    
         
             
            end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            Fabricator(:author) do
         
     | 
| 
       36 
     | 
    
         
            -
              name 'George Orwell'
         
     | 
| 
       37 
     | 
    
         
            -
              books(:count => 4) do |author, i|
         
     | 
| 
       38 
     | 
    
         
            -
                Fabricate(:book, :title => "book title #{i}", :author => author)
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
            end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            Fabricator(:hemingway, :from => :author) do
         
     | 
| 
       43 
     | 
    
         
            -
              name 'Ernest Hemingway'
         
     | 
| 
       44 
     | 
    
         
            -
            end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            Fabricator(:book) do
         
     | 
| 
       47 
     | 
    
         
            -
              title "book title"
         
     | 
| 
       48 
     | 
    
         
            -
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 7
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.7. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.7.1
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - Paul Elliott
         
     | 
| 
         @@ -14,7 +14,7 @@ autorequire: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       15 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            date: 2010-09- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-09-12 00:00:00 -04:00
         
     | 
| 
       18 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -26,10 +26,12 @@ dependencies: 
     | 
|
| 
       26 
26 
     | 
    
         
             
                - - ">="
         
     | 
| 
       27 
27 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       28 
28 
     | 
    
         
             
                    segments: 
         
     | 
| 
       29 
     | 
    
         
            -
                    -  
     | 
| 
       30 
     | 
    
         
            -
                    - 3
         
     | 
| 
      
 29 
     | 
    
         
            +
                    - 2
         
     | 
| 
       31 
30 
     | 
    
         
             
                    - 0
         
     | 
| 
       32 
     | 
    
         
            -
                     
     | 
| 
      
 31 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 32 
     | 
    
         
            +
                    - beta
         
     | 
| 
      
 33 
     | 
    
         
            +
                    - 20
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 2.0.0.beta.20
         
     | 
| 
       33 
35 
     | 
    
         
             
              type: :development
         
     | 
| 
       34 
36 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       35 
37 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -131,21 +133,20 @@ files: 
     | 
|
| 
       131 
133 
     | 
    
         
             
            - lib/fabrication/version.rb
         
     | 
| 
       132 
134 
     | 
    
         
             
            - lib/fabrication.rb
         
     | 
| 
       133 
135 
     | 
    
         
             
            - spec/fabrication/attribute_spec.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - spec/fabrication/fabricator_spec.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            - spec/fabrication/generator/active_record_spec.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - spec/fabrication/generator/base_spec.rb
         
     | 
| 
      
 139 
     | 
    
         
            +
            - spec/fabrication/generator/mongoid_spec.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - spec/fabrication/schematic_spec.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - spec/fabrication/sequence_spec.rb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - spec/fabrication/support_spec.rb
         
     | 
| 
       134 
143 
     | 
    
         
             
            - spec/fabrication_spec.rb
         
     | 
| 
       135 
     | 
    
         
            -
            - spec/fabricator_spec.rb
         
     | 
| 
       136 
144 
     | 
    
         
             
            - spec/fabricators/cool_object_fabricator.rb
         
     | 
| 
       137 
145 
     | 
    
         
             
            - spec/fabricators.rb
         
     | 
| 
       138 
     | 
    
         
            -
            - spec/generator/active_record_spec.rb
         
     | 
| 
       139 
     | 
    
         
            -
            - spec/generator/base_spec.rb
         
     | 
| 
       140 
     | 
    
         
            -
            - spec/generator/mongoid_spec.rb
         
     | 
| 
       141 
     | 
    
         
            -
            - spec/schematic_spec.rb
         
     | 
| 
       142 
     | 
    
         
            -
            - spec/sequence_spec.rb
         
     | 
| 
       143 
     | 
    
         
            -
            - spec/spec.opts
         
     | 
| 
       144 
146 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       145 
147 
     | 
    
         
             
            - spec/support/active_record.rb
         
     | 
| 
       146 
148 
     | 
    
         
             
            - spec/support/helper_objects.rb
         
     | 
| 
       147 
149 
     | 
    
         
             
            - spec/support/mongoid.rb
         
     | 
| 
       148 
     | 
    
         
            -
            - spec/support_spec.rb
         
     | 
| 
       149 
150 
     | 
    
         
             
            - README.markdown
         
     | 
| 
       150 
151 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
       151 
152 
     | 
    
         
             
            homepage: http://github.com/paulelliott/fabrication
         
     | 
    
        data/spec/spec.opts
    DELETED