Sha256: 18f3cd377f506d2bbbf968e209bf717b45d80da8a652abb43f87c4ddcd5be139

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 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") }
  let(:proxy)       { stub("proxy", :association => association) }

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

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

  it "builds the association when calling the proc" do
    subject.to_proc(proxy).call.should == association
  end

  it "builds the association when calling the proc" do
    subject.to_proc(proxy).call
    proxy.should 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 == :name }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factory_girl-2.3.2 spec/factory_girl/attribute/association_spec.rb