diff --git a/lib/factory_girl/factory.rb b/lib/factory_girl/factory.rb index 27d34c2..d6041ab 100644 --- a/lib/factory_girl/factory.rb +++ b/lib/factory_girl/factory.rb @@ -127,7 +127,7 @@ module FactoryGirl # # ... # end # - # Factory(:author).class + # FactoryGirl.create(:author).class # # => User # # Because an attribute defined without a value or block will build an @@ -142,7 +142,7 @@ module FactoryGirl # author # end # - # Factory(:post).author.class + # FactoryGirl.create(:post).author.class # # => User def aliases @options[:aliases] || [] diff --git a/lib/factory_girl/proxy.rb b/lib/factory_girl/proxy.rb index 9d14df5..f76be2d 100644 --- a/lib/factory_girl/proxy.rb +++ b/lib/factory_girl/proxy.rb @@ -56,11 +56,11 @@ module FactoryGirl # end # # # Builds (but doesn't save) a Post and a User - # Factory.build(:post) + # FactoryGirl.build(:post) # # # Builds and saves a User, builds a Post, assigns the User to the # # author association, and saves the User. - # Factory.create(:post) + # FactoryGirl.create(:post) # def association(name, overrides = {}) nil diff --git a/lib/factory_girl/sequence.rb b/lib/factory_girl/sequence.rb index 756410b..bd12fdb 100644 --- a/lib/factory_girl/sequence.rb +++ b/lib/factory_girl/sequence.rb @@ -3,8 +3,8 @@ module FactoryGirl # Raised when calling Factory.sequence from a dynamic attribute block class SequenceAbuseError < StandardError; end - # Sequences are defined using Factory.sequence. Sequence values are generated - # using next. + # Sequences are defined using sequence within a FactoryGirl.define block. + # Sequence values are generated using next. class Sequence def initialize(value = 1, &proc) #:nodoc: diff --git a/lib/factory_girl/step_definitions.rb b/lib/factory_girl/step_definitions.rb index c42f51b..31ad2a0 100644 --- a/lib/factory_girl/step_definitions.rb +++ b/lib/factory_girl/step_definitions.rb @@ -12,7 +12,7 @@ module FactoryGirlStepHelpers end model_class = factory.build_class model_class.find(:first, :conditions => attributes_find) or - Factory(factory_name, attributes) + FactoryGirl.create(factory_name, attributes) end def convert_human_hash_to_attribute_hash(human_hash, associations = []) @@ -37,22 +37,22 @@ FactoryGirl.factories.values.each do |factory| end Given /^an? #{factory.human_name} exists$/ do - Factory(factory.name) + FactoryGirl.create(factory.name) end Given /^(\d+) #{factory.human_name.pluralize} exist$/ do |count| - count.to_i.times { Factory(factory.name) } + count.to_i.times { FactoryGirl.create(factory.name) } end if factory.build_class.respond_to?(:columns) factory.build_class.columns.each do |column| human_column_name = column.name.downcase.gsub('_', ' ') Given /^an? #{factory.human_name} exists with an? #{human_column_name} of "([^"]*)"$/i do |value| - Factory(factory.name, column.name => value) + FactoryGirl.create(factory.name, column.name => value) end Given /^(\d+) #{factory.human_name.pluralize} exist with an? #{human_column_name} of "([^"]*)"$/i do |count, value| - count.to_i.times { Factory(factory.name, column.name => value) } + count.to_i.times { FactoryGirl.create(factory.name, column.name => value) } end end end diff --git a/lib/factory_girl/syntax/blueprint.rb b/lib/factory_girl/syntax/blueprint.rb index e7dcc61..17eeac8 100644 --- a/lib/factory_girl/syntax/blueprint.rb +++ b/lib/factory_girl/syntax/blueprint.rb @@ -13,7 +13,7 @@ module FactoryGirl # email { 'billy@bob.example.com' } # end # - # Factory(:user, :name => 'Johnny') + # FactoryGirl.create(:user, :name => 'Johnny') # # This syntax was derived from Pete Yandell's machinist. module Blueprint diff --git a/lib/factory_girl/syntax/generate.rb b/lib/factory_girl/syntax/generate.rb index 298d91d..3cde93d 100644 --- a/lib/factory_girl/syntax/generate.rb +++ b/lib/factory_girl/syntax/generate.rb @@ -15,14 +15,14 @@ module FactoryGirl # end # # # Creates a saved instance without raising (same as saving the result - # # of Factory.build) + # # of FactoryGirl.build) # User.generate(:name => 'Johnny') # # # Creates a saved instance and raises when invalid (same as - # # Factory.create) + # # FactoryGirl.create) # User.generate! # - # # Creates an unsaved instance (same as Factory.build) + # # Creates an unsaved instance (same as FactoryGirl.build) # User.spawn # # # Creates an instance and yields it to the passed block diff --git a/lib/factory_girl/syntax/make.rb b/lib/factory_girl/syntax/make.rb index 3ef1ba9..62cebfc 100644 --- a/lib/factory_girl/syntax/make.rb +++ b/lib/factory_girl/syntax/make.rb @@ -2,7 +2,7 @@ module FactoryGirl module Syntax # Extends ActiveRecord::Base to provide a make class method, which is a - # shortcut for Factory.create. + # shortcut for FactoryGirl.create. # # Usage: # diff --git a/lib/factory_girl/syntax/vintage.rb b/lib/factory_girl/syntax/vintage.rb index 4266055..8c6fdb5 100644 --- a/lib/factory_girl/syntax/vintage.rb +++ b/lib/factory_girl/syntax/vintage.rb @@ -20,6 +20,7 @@ module FactoryGirl # factory will be copied to the current one with an ability to override # them. # * default_strategy: +Symbol+ + # DEPRECATED. # The strategy that will be used by the Factory shortcut method. # Defaults to :create. # diff --git a/spec/acceptance/create_spec.rb b/spec/acceptance/create_spec.rb index eec4b4f..624df73 100644 --- a/spec/acceptance/create_spec.rb +++ b/spec/acceptance/create_spec.rb @@ -61,7 +61,7 @@ describe "a custom create" do end it "uses the custom create block instead of save" do - Factory(:user).should be_persisted + FactoryGirl.create(:user).should be_persisted end end diff --git a/spec/acceptance/syntax/blueprint_spec.rb b/spec/acceptance/syntax/blueprint_spec.rb index 0d3f23c..fb23f38 100644 --- a/spec/acceptance/syntax/blueprint_spec.rb +++ b/spec/acceptance/syntax/blueprint_spec.rb @@ -17,7 +17,7 @@ describe "a blueprint" do describe "after making an instance" do before do - @instance = Factory(:user, :last_name => 'Rye') + @instance = FactoryGirl.create(:user, :last_name => 'Rye') end it "should use attributes from the blueprint" do @@ -26,7 +26,7 @@ describe "a blueprint" do it "should evaluate attribute blocks for each instance" do @instance.email.should =~ /somebody\d+@example.com/ - Factory(:user).email.should_not == @instance.email + FactoryGirl.create(:user).email.should_not == @instance.email end end end diff --git a/spec/acceptance/syntax/sham_spec.rb b/spec/acceptance/syntax/sham_spec.rb index def1d71..607ce0f 100644 --- a/spec/acceptance/syntax/sham_spec.rb +++ b/spec/acceptance/syntax/sham_spec.rb @@ -26,7 +26,7 @@ describe "a factory using sham syntax" do describe "after making an instance" do before do - @instance = Factory(:user, :last_name => 'Rye') + @instance = FactoryGirl.create(:user, :last_name => 'Rye') end it "should support a sham called 'name'" do diff --git a/spec/factory_girl/proxy/attributes_for_spec.rb b/spec/factory_girl/proxy/attributes_for_spec.rb index dafb34a..0812e6f 100644 --- a/spec/factory_girl/proxy/attributes_for_spec.rb +++ b/spec/factory_girl/proxy/attributes_for_spec.rb @@ -7,7 +7,7 @@ describe FactoryGirl::Proxy::AttributesFor do describe "when asked to associate with another factory" do before do - stub(Factory).create + stub(FactoryGirl).create @proxy.associate(:owner, :user, {}) end @@ -21,9 +21,9 @@ describe FactoryGirl::Proxy::AttributesFor do end it "should not call Factory.create when building an association" do - stub(Factory).create + stub(FactoryGirl).create @proxy.association(:user).should be_nil - Factory.should have_received.create.never + FactoryGirl.should have_received.create.never end it "should always return nil when building an association" do