1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/spec/acceptance/attribute_aliases_spec.rb

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