1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Fix have_db_index_matcher bug on JRuby

So matched_index.unique actually returns an integer instead of true and returns nil instead of false in JRuby. This `!!` operator should fix it.
This commit is contained in:
Prem Sichanugrist 2011-09-18 21:40:47 +07:00
parent 6785f596b4
commit 1a3aeec47c

View file

@ -58,11 +58,11 @@ module Shoulda # :nodoc:
def correct_unique?
return true if @unique.nil?
if matched_index.unique == @unique
if !!matched_index.unique == @unique
true
else
@missing = "#{table_name} has an index named #{matched_index.name} " <<
"of unique #{matched_index.unique}, not #{@unique}."
"of unique #{!!matched_index.unique}, not #{@unique}."
false
end
end