Adjust message for AttributeDoesNotExistError

Make it a little more clear that the attribute mentioned is on the
model.
This commit is contained in:
Elliot Winkler 2015-12-30 20:40:05 -05:00
parent 830881bbed
commit a4a8a5afce
3 changed files with 12 additions and 12 deletions

View File

@ -8,8 +8,8 @@ module Shoulda
def message def message
Shoulda::Matchers.word_wrap <<-MESSAGE Shoulda::Matchers.word_wrap <<-MESSAGE
The matcher attempted to set :#{attribute_name} to #{value.inspect} on The matcher attempted to set :#{attribute_name} on the #{model.name} to
the #{model.name}, but that attribute does not exist. #{value.inspect}, but that attribute does not exist.
MESSAGE MESSAGE
end end

View File

@ -556,7 +556,7 @@ invalid and to raise a validation exception with message matching
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :nonexistent to "foo" on the Example, but The matcher attempted to set :nonexistent on the Example to "foo", but
that attribute does not exist. that attribute does not exist.
MESSAGE MESSAGE
@ -576,7 +576,7 @@ that attribute does not exist.
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :nonexistent to "foo" on the Example, but The matcher attempted to set :nonexistent on the Example to "foo", but
that attribute does not exist. that attribute does not exist.
MESSAGE MESSAGE
@ -603,8 +603,8 @@ that attribute does not exist.
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :nonexistent to "some value" on the The matcher attempted to set :nonexistent on the Example to "some
Example, but that attribute does not exist. value", but that attribute does not exist.
MESSAGE MESSAGE
expect(&assertion).to raise_error( expect(&assertion).to raise_error(
@ -629,8 +629,8 @@ Example, but that attribute does not exist.
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :nonexistent to "some value" on the The matcher attempted to set :nonexistent on the Example to "some
Example, but that attribute does not exist. value", but that attribute does not exist.
MESSAGE MESSAGE
expect(&assertion).to raise_error( expect(&assertion).to raise_error(

View File

@ -38,8 +38,8 @@ describe Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher, type: :m
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :attribute_to_confirm_confirmation to "some The matcher attempted to set :attribute_to_confirm_confirmation on the
value" on the Example, but that attribute does not exist. Example to "some value", but that attribute does not exist.
MESSAGE MESSAGE
expect(&assertion).to raise_error( expect(&assertion).to raise_error(
@ -58,8 +58,8 @@ value" on the Example, but that attribute does not exist.
end end
message = <<-MESSAGE.rstrip message = <<-MESSAGE.rstrip
The matcher attempted to set :attribute_to_confirm to "different value" The matcher attempted to set :attribute_to_confirm on the Example to
on the Example, but that attribute does not exist. "different value", but that attribute does not exist.
MESSAGE MESSAGE
expect(&assertion).to raise_error( expect(&assertion).to raise_error(