Sha256: f57e73845d8f4eed33c22ec291aeb5de4f583d696864a4ddcd29a70f3453dd9b

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

require '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

4 entries across 4 versions & 1 rubygems

Version Path
factory_girl-1.3.3 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.3.2 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.3.1 spec/factory_girl/attribute/association_spec.rb
factory_girl-1.3.0 spec/factory_girl/attribute/association_spec.rb