Fixed failing matcher tests

This commit is contained in:
Joe Ferris 2009-01-22 18:22:11 -05:00
parent ef6ffc98de
commit 3c6fb6e0b3
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -78,7 +78,7 @@ module Shoulda # :nodoc:
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 @@ module Shoulda # :nodoc:
@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