Sha256: f84e35df05233ef0f4328f14259cde6b62e35495cb7b1bd313a6889b1afcd708

Contents?: true

Size: 743 Bytes

Versions: 10

Compression:

Stored size: 743 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))

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

  it "should have a name" do
    @attr.name.should == @name
  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
    Factory::Attribute::Association.new('name', :user, {}).name.should == :name
  end
end

Version data entries

10 entries across 10 versions & 7 rubygems

Version Path
BrettRasmussen-factory_girl-1.2.2 spec/factory_girl/attribute/association_spec.rb
BrettRasmussen-factory_girl-1.2.3 spec/factory_girl/attribute/association_spec.rb
agibralter-factory_girl-1.2.1 spec/factory_girl/attribute/association_spec.rb
lacomartincik-factory_girl-1.2.1.1 spec/factory_girl/attribute/association_spec.rb
qrush-factory_girl-1.2.1.1 spec/factory_girl/attribute/association_spec.rb
thoughtbot-factory_girl-1.2.2 spec/factory_girl/attribute/association_spec.rb
ttilley-factory_girl-1.2.2.1 spec/factory_girl/attribute/association_spec.rb
ttilley-factory_girl-1.2.2.2 spec/factory_girl/attribute/association_spec.rb
ttilley-factory_girl-1.2.2 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.2.2 spec/factory_girl/attribute/association_spec.rb