Permalink
Browse files

fix brittle rails 3.0 test/mocking

  • Loading branch information...
1 parent e2cd5b1 commit a109c12452513339b39debf1b1b89b46936363a2 @jenseng committed Dec 14, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 test/immigrant_test.rb
View
@@ -20,7 +20,7 @@ def supports_primary_key? # AR <3.2
true
end
def primary_key(table)
- table !~ /s_.*s\z/ ? 'id' : nil
+ table.to_s !~ /s_.*s\z/ ? 'id' : nil
end
end
@@ -143,19 +143,19 @@ class Fan < MockModel; end
test 'has_and_belongs_to_many should respect the join_table' do
class Author < MockModel
- has_and_belongs_to_many :fans, :join_table => :lol_wuts
+ has_and_belongs_to_many :fans, :join_table => :lols_wuts
end
class Fan < MockModel; end
keys = Immigrant.infer_keys([], [Author, Fan]).first
assert_nothing_raised { keys.map { |key| key.to_ruby(:add) } }
assert_equal(
[foreign_key_definition(
- 'lol_wuts', 'authors',
+ 'lols_wuts', 'authors',
:column => 'author_id', :primary_key => 'id', :dependent => nil
),
foreign_key_definition(
- 'lol_wuts', 'fans',
+ 'lols_wuts', 'fans',
:column => 'fan_id', :primary_key => 'id', :dependent => nil
)],
keys

0 comments on commit a109c12

Please sign in to comment.