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

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' load 'tasks/shoulda.rake'
# Test::Unit::UI::VERBOSE # 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| Rake::TestTask.new do |t|
t.libs << 'lib' t.libs << 'lib'
t.pattern = test_files_pattern t.pattern = test_files_pattern

View file

@ -78,7 +78,7 @@ module Shoulda # :nodoc:
if @scopes.blank? if @scopes.blank?
true true
else else
@scopes.each do |scope| @scopes.all? do |scope|
previous_value = @existing.send(scope) previous_value = @existing.send(scope)
# Assume the scope is a foreign key if the field is nil # Assume the scope is a foreign key if the field is nil
@ -88,7 +88,14 @@ module Shoulda # :nodoc:
@subject.send("#{scope}=", next_value) @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 end
end end