Sha256: 22dca6635b8351c3e15a280c46e4f61146ebbe75d07f3494c3187dcf2c39b24e

Contents?: true

Size: 895 Bytes

Versions: 16

Compression:

Stored size: 895 Bytes

Contents

require 'spec_helper'

describe FactoryGirl::Attribute::Association do
  let(:name)        { :author }
  let(:factory)     { :user }
  let(:overrides)   { { first_name: "John" } }
  let(:association) { stub("association") }

  subject { FactoryGirl::Attribute::Association.new(name, factory, overrides) }
  before  { subject.stubs(association: association) }

  it         { should be_association }
  its(:name) { should eq name }

  it "builds the association when calling the proc" do
    expect(subject.to_proc.call).to eq association
  end

  it "builds the association when calling the proc" do
    subject.to_proc.call
    expect(subject).to have_received(:association).with(factory, overrides)
  end
end

describe FactoryGirl::Attribute::Association, "with a string name" do
  subject    { FactoryGirl::Attribute::Association.new("name", :user, {}) }
  its(:name) { should eq :name }
end

Version data entries

16 entries across 13 versions & 5 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/factory_girl-4.5.0/spec/factory_girl/attribute/association_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/attribute/association_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/attribute/association_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/attribute/association_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/factory_girl/attribute/association_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/factory_girl/attribute/association_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/factory_girl/attribute/association_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/factory_girl/attribute/association_spec.rb
factory_girl-4.5.0 spec/factory_girl/attribute/association_spec.rb
factory_girl-4.4.0 spec/factory_girl/attribute/association_spec.rb
factory_girl-4.3.0 spec/factory_girl/attribute/association_spec.rb
challah-1.0.0 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/attribute/association_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/attribute/association_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/attribute/association_spec.rb
challah-1.0.0.beta vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/attribute/association_spec.rb
factory_girl-4.2.0 spec/factory_girl/attribute/association_spec.rb