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.7.5 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/factory_girl-3.6.1/spec/acceptance/syntax/make_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/factory_girl-3.6.1/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/syntax/make_spec.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/syntax/make_spec.rb