Sha256: 790f942b6f4b0071bbc40dfa8f4a01adbc2e935cc55267f912f5ebedacf47804

Contents?: true

Size: 833 Bytes

Versions: 13

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'

describe FactoryGirl::Attribute::Association do
  before do
    @name      = :author
    @factory   = :user
    @overrides = { :first_name => 'John' }
    @attr      = FactoryGirl::Attribute::Association.new(@name, @factory, @overrides)
  end

  it "should have a name" do
    @attr.name.should == @name
  end

  it "is an association" do
    @attr.should be_association
  end

  it "should have a factory" do
    @attr.factory.should == @factory
  end

  it "should tell the proxy to associate when being added to a proxy" do
    proxy = "proxy"
    stub(proxy).associate
    @attr.add_to(proxy)
    proxy.should have_received.associate(@name, @factory, @overrides)
  end

  it "should convert names to symbols" do
    FactoryGirl::Attribute::Association.new('name', :user, {}).name.should == :name
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
factory_girl-2.0.4 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.3 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.2 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.1 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.rc4 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.rc3 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.rc2 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.rc1 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.beta5 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.beta4 spec/factory_girl/attribute/association_spec.rb
factory_girl-2.0.0.beta3 spec/factory_girl/attribute/association_spec.rb
factory_girl_kibiz0r-2.0.0.beta3 spec/factory_girl/attribute/association_spec.rb
factory_girl_kibiz0r-2.0.0.beta2 spec/factory_girl/attribute/association_spec.rb