Sha256: 966ca0ee8338504b22c4e08ccacb1d0207139422a933a6368fd70d2144a1fc55

Contents?: true

Size: 819 Bytes

Versions: 16

Compression:

Stored size: 819 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 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
    Factory::Attribute::Association.new('name', :user, {}).name.should == :name
  end
end

Version data entries

16 entries across 16 versions & 8 rubygems

Version Path
vitalish-factory_girl-1.2.10 spec/factory_girl/attribute/association_spec.rb
vitalish-factory_girl-1.2.9 spec/factory_girl/attribute/association_spec.rb
vitalish-factory_girl-1.2.8 spec/factory_girl/attribute/association_spec.rb
vitalish-factory_girl-1.2.7 spec/factory_girl/attribute/association_spec.rb
vitalish-factory_girl-1.2.6 spec/factory_girl/attribute/association_spec.rb
lockbox_middleware-1.2.1 vendor/gems/factory_girl-1.2.3/spec/factory_girl/attribute/association_spec.rb
malvestuto_factory_girl-1.2.5 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.2.4 spec/factory_girl/attribute/association_spec.rb
jeffrafter-factory_girl-1.2.3 spec/factory_girl/attribute/association_spec.rb
masa-iwasaki-factory_girl-1.2.3.2 spec/factory_girl/attribute/association_spec.rb
masa-iwasaki-factory_girl-1.2.3.1 spec/factory_girl/attribute/association_spec.rb
dm-factory_girl-1.2.3 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.2.3 spec/factory_girl/attribute/association_spec.rb
freegenie-factory_girl-1.2.4 spec/factory_girl/attribute/association_spec.rb
freegenie-factory_girl-1.2.3 spec/factory_girl/attribute/association_spec.rb
freegenie-factory_girl-1.2.2 spec/factory_girl/attribute/association_spec.rb