Permalink
Browse files

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.
  • Loading branch information...
1 parent 6785f59 commit 1a3aeec47cfb6c340f084a096829264d5bfbd80a @sikachu sikachu committed Sep 18, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/shoulda/matchers/active_record/have_db_index_matcher.rb
@@ -58,11 +58,11 @@ def index_exists?
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

0 comments on commit 1a3aeec

Please sign in to comment.