mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
25 lines
462 B
Ruby
25 lines
462 B
Ruby
require 'spec_helper'
|
|
require 'acceptance/acceptance_helper'
|
|
|
|
describe "attribute aliases" do
|
|
before do
|
|
define_model('User')
|
|
|
|
define_model('Post', :user_id => :integer) do
|
|
belongs_to :user
|
|
end
|
|
|
|
FactoryGirl.define do
|
|
factory :user
|
|
|
|
factory :post do
|
|
user
|
|
end
|
|
end
|
|
end
|
|
|
|
it "doesn't assign both an association and its foreign key" do
|
|
FactoryGirl.build(:post, :user_id => 1).user_id.should == 1
|
|
end
|
|
end
|
|
|