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/test/aliases_test.rb

30 lines
739 B
Ruby
Raw Normal View History

2008-07-30 15:47:12 -04:00
require(File.join(File.dirname(__FILE__), 'test_helper'))
class AliasesTest < Test::Unit::TestCase
should "include an attribute as an alias for itself by default" do
assert Factory.aliases_for(:test).include?(:test)
end
should "include the root of a foreign key as an alias by default" do
assert Factory.aliases_for(:test_id).include?(:test)
end
should "include an attribute's foreign key as an alias by default" do
assert Factory.aliases_for(:test).include?(:test_id)
end
context "after adding an alias" do
setup do
Factory.alias(/(.*)_suffix/, '\1')
end
should "return the alias in the aliases list" do
assert Factory.aliases_for(:test_suffix).include?(:test)
end
end
end