Sha256: 3668064fe99ad639cfa9bf0b9de19edcf46ba53d3dfa15f069016f052f55e822

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 Bytes

Contents

require 'spec_helper'
require 'acceptance/acceptance_helper'

require 'factory_girl/syntax/make'

describe "a factory using make syntax" do
  before do
    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 making an instance" do
    before do
      @instance = User.make(:last_name => 'Rye')
    end

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

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

    it "should save the record" do
      @instance.should_not be_new_record
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
factory_girl_kibiz0r-2.0.0.beta3 spec/acceptance/syntax/make_spec.rb
factory_girl_kibiz0r-2.0.0.beta2 spec/acceptance/syntax/make_spec.rb
factory_girl-2.0.0.beta2 spec/acceptance/syntax/make_spec.rb