Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed failing matcher tests

  • Loading branch information...
commit 3c6fb6e0b306f5b06058fac35c1c60b4f4754102 1 parent ef6ffc9
Joe Ferris jferris authored
2  Rakefile
View
@@ -8,7 +8,7 @@ require 'shoulda'
load 'tasks/shoulda.rake'
# Test::Unit::UI::VERBOSE
-test_files_pattern = 'test/{unit,functional,other}/**/*_test.rb'
+test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb'
Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = test_files_pattern
11 lib/shoulda/active_record/matchers/require_unique_attribute_matcher.rb
View
@@ -78,7 +78,7 @@ def validate_after_scope_change
if @scopes.blank?
true
else
- @scopes.each do |scope|
+ @scopes.all? do |scope|
previous_value = @existing.send(scope)
# Assume the scope is a foreign key if the field is nil
@@ -88,7 +88,14 @@ def validate_after_scope_change
@subject.send("#{scope}=", next_value)
- allows_value_of(existing_value, @expected_message)
+ if allows_value_of(existing_value, @expected_message)
+ @negative_failure_message <<
+ " (with different value of #{scope})"
+ true
+ else
+ @failure_message << " (with different value of #{scope})"
+ false
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.