Sha256: d4f16743c0cc0dfeb4541c7b018baa7fc97ca7ca50bccab3c5acf2c2bc5b2370

Contents?: true

Size: 578 Bytes

Versions: 10

Compression:

Stored size: 578 Bytes

Contents

require 'spec_helper'
require 'acceptance/acceptance_helper'

describe "a built instance" do
  include FactoryGirl::Syntax::Methods

  before do
    define_model('User')

    define_model('Post', :user_id => :integer) do
      belongs_to :user
    end

    FactoryGirl.define do
      factory :user

      factory :post do
        user
      end
    end
  end

  subject { build(:post) }

  it "isn't saved" do
    should be_new_record
  end

  it "assigns and saves associations" do
    subject.user.should be_kind_of(User)
    subject.user.should_not be_new_record
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
factory_girl-2.0.4 spec/acceptance/build_spec.rb
factory_girl-2.0.3 spec/acceptance/build_spec.rb
factory_girl-2.0.2 spec/acceptance/build_spec.rb
factory_girl-2.0.1 spec/acceptance/build_spec.rb
factory_girl-2.0.0.rc4 spec/acceptance/build_spec.rb
factory_girl-2.0.0.rc3 spec/acceptance/build_spec.rb
factory_girl-2.0.0.rc2 spec/acceptance/build_spec.rb
factory_girl-2.0.0.rc1 spec/acceptance/build_spec.rb
factory_girl-2.0.0.beta5 spec/acceptance/build_spec.rb
factory_girl-2.0.0.beta4 spec/acceptance/build_spec.rb