Sha256: dc97d0f6337432758f2506615022f144338cd84a45d66cb0f005990ff2dae7d9

Contents?: true

Size: 1.08 KB

Versions: 126

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

require 'factory_girl/syntax/make'

describe "a factory using make syntax" do
  before do
    ActiveSupport::Deprecation.silenced = true

    define_model('User', first_name: :string, last_name: :string)

    FactoryGirl.define do
      factory :user do
        first_name 'Bill'
        last_name  'Nye'
      end
    end
  end

  describe "after make" do
    before do
      @instance = User.make(last_name: 'Rye')
    end

    it "uses attributes from the factory" do
      @instance.first_name.should == 'Bill'
    end

    it "uses attributes passed to make" do
      @instance.last_name.should == 'Rye'
    end

    it "builds the record" do
      @instance.should be_new_record
    end
  end

  describe "after make!" do
    before do
      @instance = User.make!(last_name: 'Rye')
    end

    it "uses attributes from the factory" do
      @instance.first_name.should == 'Bill'
    end

    it "uses attributes passed to make" do
      @instance.last_name.should == 'Rye'
    end

    it "saves the record" do
      @instance.should_not be_new_record
    end
  end
end

Version data entries

126 entries across 72 versions & 6 rubygems

Version Path
classiccms-0.4.0 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.4.0 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.3.9 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.3.9 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
challah-0.6.2 vendor/bundle/gems/factory_girl-3.5.0/spec/acceptance/syntax/make_spec.rb
challah-0.6.2 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
factory_girl-3.5.0 spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
factory_girl-3.4.2 spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
factory_girl-3.4.1 spec/acceptance/syntax/make_spec.rb
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
factory_girl-3.4.0 spec/acceptance/syntax/make_spec.rb
classiccms-0.3.8 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb