From a4a8a5afce8b8bdfee1cb00b579306bcd6bb5991 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Wed, 30 Dec 2015 20:40:05 -0500 Subject: [PATCH] Adjust message for AttributeDoesNotExistError Make it a little more clear that the attribute mentioned is on the model. --- .../attribute_does_not_exist_error.rb | 4 ++-- .../active_model/allow_value_matcher_spec.rb | 12 ++++++------ .../validate_confirmation_of_matcher_spec.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb b/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb index 315712b7..a56066c4 100644 --- a/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb +++ b/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_does_not_exist_error.rb @@ -8,8 +8,8 @@ module Shoulda def message Shoulda::Matchers.word_wrap <<-MESSAGE -The matcher attempted to set :#{attribute_name} to #{value.inspect} on -the #{model.name}, but that attribute does not exist. +The matcher attempted to set :#{attribute_name} on the #{model.name} to +#{value.inspect}, but that attribute does not exist. MESSAGE end diff --git a/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb index f449ea5a..6dc0b844 100644 --- a/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb @@ -556,7 +556,7 @@ invalid and to raise a validation exception with message matching end 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. MESSAGE @@ -576,7 +576,7 @@ that attribute does not exist. end 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. MESSAGE @@ -603,8 +603,8 @@ that attribute does not exist. end message = <<-MESSAGE.rstrip -The matcher attempted to set :nonexistent to "some value" on the -Example, but that attribute does not exist. +The matcher attempted to set :nonexistent on the Example to "some +value", but that attribute does not exist. MESSAGE expect(&assertion).to raise_error( @@ -629,8 +629,8 @@ Example, but that attribute does not exist. end message = <<-MESSAGE.rstrip -The matcher attempted to set :nonexistent to "some value" on the -Example, but that attribute does not exist. +The matcher attempted to set :nonexistent on the Example to "some +value", but that attribute does not exist. MESSAGE expect(&assertion).to raise_error( diff --git a/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb index 0fb5bdf7..23449fae 100644 --- a/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb @@ -38,8 +38,8 @@ describe Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher, type: :m end message = <<-MESSAGE.rstrip -The matcher attempted to set :attribute_to_confirm_confirmation to "some -value" on the Example, but that attribute does not exist. +The matcher attempted to set :attribute_to_confirm_confirmation on the +Example to "some value", but that attribute does not exist. MESSAGE expect(&assertion).to raise_error( @@ -58,8 +58,8 @@ value" on the Example, but that attribute does not exist. end message = <<-MESSAGE.rstrip -The matcher attempted to set :attribute_to_confirm to "different value" -on the Example, but that attribute does not exist. +The matcher attempted to set :attribute_to_confirm on the Example to +"different value", but that attribute does not exist. MESSAGE expect(&assertion).to raise_error(