Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #108 : RSpec 2.10 compatibility

commit 875cd9a21ba1b32b70638100c5714bf4ffbb7fc3 1 parent f7337c6
Brian Shaver authored
Showing with 115 additions and 115 deletions.
  1. +7 −7 lib/shoulda/matchers/action_controller/assign_to_matcher.rb
  2. +2 −2 lib/shoulda/matchers/action_controller/filter_param_matcher.rb
  3. +3 −3 lib/shoulda/matchers/action_controller/redirect_to_matcher.rb
  4. +3 −3 lib/shoulda/matchers/action_controller/render_template_matcher.rb
  5. +2 −2 lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb
  6. +2 −2 lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb
  7. +2 −2 lib/shoulda/matchers/action_controller/respond_with_matcher.rb
  8. +4 −4 lib/shoulda/matchers/action_controller/route_matcher.rb
  9. +2 −2 lib/shoulda/matchers/action_controller/set_session_matcher.rb
  10. +3 −3 lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb
  11. +2 −2 lib/shoulda/matchers/action_mailer/have_sent_email_matcher.rb
  12. +6 −6 lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb
  13. +2 −2 lib/shoulda/matchers/active_model/allow_value_matcher.rb
  14. +2 −2 lib/shoulda/matchers/active_model/disallow_value_matcher.rb
  15. +1 −1  lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb
  16. +2 −2 lib/shoulda/matchers/active_model/only_integer_matcher.rb
  17. +2 −2 lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb
  18. +3 −3 lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb
  19. +7 −7 lib/shoulda/matchers/active_model/validation_matcher.rb
  20. +2 −2 lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb
  21. +2 −2 lib/shoulda/matchers/active_record/association_matcher.rb
  22. +2 −2 lib/shoulda/matchers/active_record/have_db_column_matcher.rb
  23. +2 −2 lib/shoulda/matchers/active_record/have_db_index_matcher.rb
  24. +4 −4 lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb
  25. +2 −2 lib/shoulda/matchers/active_record/query_the_database_matcher.rb
  26. +2 −2 lib/shoulda/matchers/active_record/serialize_matcher.rb
  27. +1 −1  lib/shoulda/matchers/independent/delegate_matcher.rb
  28. +1 −1  spec/shoulda/matchers/action_controller/assign_to_matcher_spec.rb
  29. +1 −1  spec/shoulda/matchers/action_controller/filter_param_matcher_spec.rb
  30. +16 −16 spec/shoulda/matchers/action_mailer/have_sent_email_spec.rb
  31. +1 −1  spec/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb
  32. +1 −1  spec/shoulda/matchers/active_model/allow_value_matcher_spec.rb
  33. +2 −2 spec/shoulda/matchers/active_model/disallow_value_matcher_spec.rb
  34. +1 −1  spec/shoulda/matchers/active_model/only_integer_matcher_spec.rb
  35. +2 −2 spec/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb
  36. +6 −6 spec/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb
  37. +2 −2 spec/shoulda/matchers/active_record/association_matcher_spec.rb
  38. +1 −1  spec/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb
  39. +3 −3 spec/shoulda/matchers/active_record/serialize_matcher_spec.rb
  40. +4 −4 spec/shoulda/matchers/independent/delegate_matcher_spec.rb
View
14 lib/shoulda/matchers/action_controller/assign_to_matcher.rb
@@ -19,7 +19,7 @@ def assign_to(variable)
end
class AssignToMatcher # :nodoc:
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def initialize(variable)
@variable = variable.to_s
@@ -64,12 +64,12 @@ def in_context(context)
def assigned_value?
if @controller.instance_variables.map(&:to_s).include?("@#{@variable}")
- @negative_failure_message =
+ @failure_message_for_should_not =
"Didn't expect action to assign a value for @#{@variable}, " <<
"but it was assigned to #{assigned_value.inspect}"
true
else
- @failure_message =
+ @failure_message_for_should =
"Expected action to assign a value for @#{@variable}"
false
end
@@ -78,12 +78,12 @@ def assigned_value?
def kind_of_expected_class?
if @options.key?(:expected_class)
if assigned_value.kind_of?(@options[:expected_class])
- @negative_failure_message =
+ @failure_message_for_should_not =
"Didn't expect action to assign a kind of #{@options[:expected_class]} " <<
"for #{@variable}, but got one anyway"
true
else
- @failure_message =
+ @failure_message_for_should =
"Expected action to assign a kind of #{@options[:expected_class]} " <<
"for #{@variable}, but got #{assigned_value.inspect} " <<
"(#{assigned_value.class.name})"
@@ -97,12 +97,12 @@ def kind_of_expected_class?
def equal_to_expected_value?
if @options[:check_value]
if @options[:expected_value] == assigned_value
- @negative_failure_message =
+ @failure_message_for_should_not =
"Didn't expect action to assign #{@options[:expected_value].inspect} " <<
"for #{@variable}, but got it anyway"
true
else
- @failure_message =
+ @failure_message_for_should =
"Expected action to assign #{@options[:expected_value].inspect} " <<
"for #{@variable}, but got #{assigned_value.inspect}"
false
View
4 lib/shoulda/matchers/action_controller/filter_param_matcher.rb
@@ -19,11 +19,11 @@ def matches?(controller)
filters_key?
end
- def failure_message
+ def failure_message_for_should
"Expected #{@key} to be filtered; filtered keys: #{filtered_keys.join(', ')}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{@key} to be filtered"
end
View
6 lib/shoulda/matchers/action_controller/redirect_to_matcher.rb
@@ -12,7 +12,7 @@ def redirect_to(url_or_description, &block)
end
class RedirectToMatcher # :nodoc:
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def initialize(url_or_description, context, &block)
if block
@@ -44,10 +44,10 @@ def description
def redirects_to_url?
begin
@context.send(:assert_redirected_to, url)
- @negative_failure_message = "Didn't expect to redirect to #{url}"
+ @failure_message_for_should_not = "Didn't expect to redirect to #{url}"
true
rescue Shoulda::Matchers::AssertionError => error
- @failure_message = error.message
+ @failure_message_for_should = error.message
false
end
end
View
6 lib/shoulda/matchers/action_controller/render_template_matcher.rb
@@ -20,7 +20,7 @@ def render_template(options = {}, message = nil)
end
class RenderTemplateMatcher # :nodoc:
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def initialize(options, message, context)
@options = options
@@ -48,10 +48,10 @@ def in_context(context)
def renders_template?
begin
@context.send(:assert_template, @options, @message)
- @negative_failure_message = "Didn't expect to render #{@template}"
+ @failure_message_for_should_not = "Didn't expect to render #{@template}"
true
rescue Shoulda::Matchers::AssertionError => error
- @failure_message = error.message
+ @failure_message_for_should = error.message
false
end
end
View
4 lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb
@@ -33,11 +33,11 @@ def matches?(controller)
rendered_with_layout? && rendered_with_expected_layout?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}, but #{result}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}, but #{result}"
end
View
4 lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb
@@ -35,11 +35,11 @@ def matches?(controller)
content_type_matches_regexp? || content_type_matches_string?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
4 lib/shoulda/matchers/action_controller/respond_with_matcher.rb
@@ -30,11 +30,11 @@ def matches?(controller)
correct_status_code? || correct_status_code_range?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
8 lib/shoulda/matchers/action_controller/route_matcher.rb
@@ -33,7 +33,7 @@ def initialize(method, path, context)
@context = context
end
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def to(params)
@params = stringify_params(params)
@@ -80,13 +80,13 @@ def route_recognized?
{ :method => @method, :path => @path },
@params)
- @negative_failure_message = "Didn't expect to #{description}"
+ @failure_message_for_should_not = "Didn't expect to #{description}"
true
rescue ::ActionController::RoutingError => error
- @failure_message = error.message
+ @failure_message_for_should = error.message
false
rescue Shoulda::Matchers::AssertionError => error
- @failure_message = error.message
+ @failure_message_for_should = error.message
false
end
end
View
4 lib/shoulda/matchers/action_controller/set_session_matcher.rb
@@ -32,11 +32,11 @@ def matches?(controller)
assigned_correct_value? || cleared_value?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}, but #{result}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Didn't expect #{expectation}, but #{result}"
end
View
6 lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb
@@ -22,7 +22,7 @@ def initialize
@options = {}
end
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def to(value)
if !value.is_a?(String) && !value.is_a?(Regexp)
@@ -53,11 +53,11 @@ def description
description
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
4 lib/shoulda/matchers/action_mailer/have_sent_email_matcher.rb
@@ -106,11 +106,11 @@ def matches?(subject)
end
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
12 lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb
@@ -16,7 +16,7 @@ def allow_mass_assignment_of(value)
end
class AllowMassAssignmentOfMatcher # :nodoc:
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def initialize(attribute)
@attribute = attribute.to_s
@@ -35,12 +35,12 @@ def matches?(subject)
@subject = subject
if attr_mass_assignable?
if whitelisting?
- @negative_failure_message = "#{@attribute} was made accessible"
+ @failure_message_for_should_not = "#{@attribute} was made accessible"
else
if protected_attributes.empty?
- @negative_failure_message = 'no attributes were protected'
+ @failure_message_for_should_not = 'no attributes were protected'
else
- @negative_failure_message = "#{class_name} is protecting " <<
+ @failure_message_for_should_not = "#{class_name} is protecting " <<
"#{protected_attributes.to_a.to_sentence}, " <<
"but not #{@attribute}."
end
@@ -48,9 +48,9 @@ def matches?(subject)
true
else
if whitelisting?
- @failure_message = "Expected #{@attribute} to be accessible"
+ @failure_message_for_should = "Expected #{@attribute} to be accessible"
else
- @failure_message = "Did not expect #{@attribute} to be protected"
+ @failure_message_for_should = "Did not expect #{@attribute} to be protected"
end
false
end
View
4 lib/shoulda/matchers/active_model/allow_value_matcher.rb
@@ -60,11 +60,11 @@ def matches?(instance)
end
end
- def failure_message
+ def failure_message_for_should
"Did not expect #{expectation}, got error: #{@matched_error}"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Expected #{expectation}, got #{error_description}"
end
View
4 lib/shoulda/matchers/active_model/disallow_value_matcher.rb
@@ -20,8 +20,8 @@ def with_message(message)
self
end
- def failure_message
- @allow_matcher.negative_failure_message
+ def failure_message_for_should
+ @allow_matcher.failure_message_for_should_not
end
def allowed_types
View
2  lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb
@@ -88,7 +88,7 @@ def matches?(subject)
if allows_all_values_in_array? && allows_blank_value? && allows_nil_value? && disallows_value_outside_of_array?
true
else
- @failure_message = "#{@array} doesn't match array in validation"
+ @failure_message_for_should = "#{@array} doesn't match array in validation"
false
end
end
View
4 lib/shoulda/matchers/active_model/only_integer_matcher.rb
@@ -24,8 +24,8 @@ def allowed_types
'integer'
end
- def failure_message
- @disallow_value_matcher.failure_message
+ def failure_message_for_should
+ @disallow_value_matcher.failure_message_for_should
end
end
end
View
4 lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb
@@ -48,7 +48,7 @@ def description
"only allow #{allowed_types} values for #{@attribute}"
end
- def failure_message
+ def failure_message_for_should
submatcher_failure_messages.last
end
@@ -71,7 +71,7 @@ def submatchers_match?
end
def submatcher_failure_messages
- failing_submatchers.map(&:failure_message)
+ failing_submatchers.map(&:failure_message_for_should)
end
def failing_submatchers
View
6 lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb
@@ -97,7 +97,7 @@ def set_scoped_attributes
@subject.send(setter, existing.send(scope))
true
else
- @failure_message = "#{class_name} doesn't seem to have a #{scope} attribute."
+ @failure_message_for_should = "#{class_name} doesn't seem to have a #{scope} attribute."
false
end
end
@@ -134,11 +134,11 @@ def validate_after_scope_change?
if allows_value_of(existing_value, @expected_message)
@subject.send("#{scope}=", previous_value)
- @negative_failure_message <<
+ @failure_message_for_should_not <<
" (with different value of #{scope})"
true
else
- @failure_message << " (with different value of #{scope})"
+ @failure_message_for_should << " (with different value of #{scope})"
false
end
end
View
14 lib/shoulda/matchers/active_model/validation_matcher.rb
@@ -2,7 +2,7 @@ module Shoulda # :nodoc:
module Matchers
module ActiveModel # :nodoc:
class ValidationMatcher # :nodoc:
- attr_reader :failure_message
+ attr_reader :failure_message_for_should
def initialize(attribute)
@attribute = attribute
@@ -14,8 +14,8 @@ def strict
self
end
- def negative_failure_message
- @negative_failure_message || @failure_message
+ def failure_message_for_should_not
+ @failure_message_for_should_not || @failure_message_for_should
end
def matches?(subject)
@@ -29,10 +29,10 @@ def allows_value_of(value, message = nil)
allow = allow_value_matcher(value, message)
if allow.matches?(@subject)
- @negative_failure_message = allow.failure_message
+ @failure_message_for_should_not = allow.failure_message_for_should
true
else
- @failure_message = allow.negative_failure_message
+ @failure_message_for_should = allow.failure_message_for_should_not
false
end
end
@@ -41,10 +41,10 @@ def disallows_value_of(value, message = nil)
disallow = allow_value_matcher(value, message)
if disallow.matches?(@subject)
- @failure_message = disallow.negative_failure_message
+ @failure_message_for_should = disallow.failure_message_for_should_not
false
else
- @negative_failure_message = disallow.failure_message
+ @failure_message_for_should_not = disallow.failure_message_for_should
true
end
end
View
4 lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb
@@ -50,11 +50,11 @@ def matches?(subject)
update_only_correct?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation} (#{@problem})"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
4 lib/shoulda/matchers/active_record/association_matcher.rb
@@ -124,11 +124,11 @@ def matches?(subject)
validate_correct?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation} (#{@missing})"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
4 lib/shoulda/matchers/active_record/have_db_column_matcher.rb
@@ -51,11 +51,11 @@ def matches?(subject)
correct_primary?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation} (#{@missing})"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
4 lib/shoulda/matchers/active_record/have_db_index_matcher.rb
@@ -37,11 +37,11 @@ def matches?(subject)
index_exists? && correct_unique?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation} (#{@missing})"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
8 lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb
@@ -16,19 +16,19 @@ def initialize(attribute)
@attribute = attribute.to_s
end
- attr_reader :failure_message, :negative_failure_message
+ attr_reader :failure_message_for_should, :failure_message_for_should_not
def matches?(subject)
@subject = subject
if readonly_attributes.include?(@attribute)
- @negative_failure_message = "Did not expect #{@attribute} to be read-only"
+ @failure_message_for_should_not = "Did not expect #{@attribute} to be read-only"
true
else
if readonly_attributes.empty?
- @failure_message = "#{class_name} attribute #{@attribute} " <<
+ @failure_message_for_should = "#{class_name} attribute #{@attribute} " <<
'is not read-only'
else
- @failure_message = "#{class_name} is making " <<
+ @failure_message_for_should = "#{class_name} is making " <<
"#{readonly_attributes.to_a.to_sentence} " <<
"read-only, but not #{@attribute}."
end
View
4 lib/shoulda/matchers/active_record/query_the_database_matcher.rb
@@ -67,7 +67,7 @@ def matches?(subject)
end
end
- def failure_message
+ def failure_message_for_should
if @options.key?(:expected_query_count)
"Expected ##{@options[:method_name]} to cause #{@options[:expected_query_count]} database queries but it actually caused #{@queries.length} queries:" + friendly_queries
else
@@ -75,7 +75,7 @@ def failure_message
end
end
- def negative_failure_message
+ def failure_message_for_should_not
if @options[:expected_query_count]
"Expected ##{@options[:method_name]} to not cause #{@options[:expected_query_count]} database queries but it actually caused #{@queries.length} queries:" + friendly_queries
else
View
4 lib/shoulda/matchers/active_record/serialize_matcher.rb
@@ -36,11 +36,11 @@ def matches?(subject)
serialization_valid? && type_valid?
end
- def failure_message
+ def failure_message_for_should
"Expected #{expectation} (#{@missing})"
end
- def negative_failure_message
+ def failure_message_for_should_not
"Did not expect #{expectation}"
end
View
2  lib/shoulda/matchers/independent/delegate_matcher.rb
@@ -62,7 +62,7 @@ def with_arguments(*arguments)
self
end
- def failure_message
+ def failure_message_for_should
base = "Expected #{delegating_method_name} to delegate to #{target_method_name}"
add_clarifications_to(base)
end
View
2  spec/shoulda/matchers/action_controller/assign_to_matcher_spec.rb
@@ -12,7 +12,7 @@ def to_s
matcher = assign_to(:var).with_kind_of(Fixnum)
matcher.matches?(controller)
- matcher.failure_message.should =~ /but got wrong class \(WrongClass\)$/
+ matcher.failure_message_for_should.should =~ /but got wrong class \(WrongClass\)$/
end
context 'a controller that assigns to an instance variable' do
View
2  spec/shoulda/matchers/action_controller/filter_param_matcher_spec.rb
@@ -13,7 +13,7 @@
matcher.matches?(nil).should be_false
- matcher.failure_message.should =~ /Expected other to be filtered.*secret/
+ matcher.failure_message_for_should.should =~ /Expected other to be filtered.*secret/
end
def filter(param)
View
32 spec/shoulda/matchers/action_mailer/have_sent_email_spec.rb
@@ -120,7 +120,7 @@ def the_email(params)
should_not have_sent_email.multipart
matcher = have_sent_email.multipart(true)
matcher.matches?(Mailer.the_email(nil))
- matcher.failure_message.should =~ /Expected sent email being multipart/
+ matcher.failure_message_for_should.should =~ /Expected sent email being multipart/
end
it 'matches the body with a regexp' do
@@ -155,98 +155,98 @@ def the_email(params)
should have_sent_email.with_subject(/is spam$/)
matcher = have_sent_email.with_subject(/totally safe/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with subject/
+ matcher.failure_message_for_should.should =~ /Expected sent email with subject/
end
it 'accepts sent e-mail based on a string sender' do
should have_sent_email.from('do-not-reply@example.com')
matcher = have_sent_email.from('you@example.com')
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email from/
+ matcher.failure_message_for_should.should =~ /Expected sent email from/
end
it 'accepts sent e-mail based on a regexp sender' do
should have_sent_email.from(/@example\.com/)
matcher = have_sent_email.from(/you@/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email from/
+ matcher.failure_message_for_should.should =~ /Expected sent email from/
end
it 'accepts sent e-mail based on the body' do
should have_sent_email.with_body(/is spam\./)
matcher = have_sent_email.with_body(/totally safe/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with body/
+ matcher.failure_message_for_should.should =~ /Expected sent email with body/
end
it 'accepts sent e-mail based on a text/plain part' do
should have_sent_email.with_part('text/plain', /is spam\./)
matcher = have_sent_email.with_part('text/plain', /HTML is spam/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with a text\/plain part containing/
+ matcher.failure_message_for_should.should =~ /Expected sent email with a text\/plain part containing/
end
it 'accepts sent e-mail based on a text/html part' do
should have_sent_email.with_part('text/html', /HTML is spam/)
matcher = have_sent_email.with_part('text/html', /HTML is not spam\./)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with a text\/html part containing/
+ matcher.failure_message_for_should.should =~ /Expected sent email with a text\/html part containing/
end
it 'accept sent e-mail based on the recipient' do
should have_sent_email.to('myself@me.com')
matcher = have_sent_email.to('you@example.com')
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email to/
+ matcher.failure_message_for_should.should =~ /Expected sent email to/
end
it 'accepts sent e-mail based on cc string' do
should have_sent_email.cc('joe@bob.com')
matcher = have_sent_email.cc('you@example.com')
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email cc/
+ matcher.failure_message_for_should.should =~ /Expected sent email cc/
end
it 'accepts sent-email based on cc regex' do
should have_sent_email.cc(/@bob\.com/)
matcher = have_sent_email.cc(/us@/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email cc/
+ matcher.failure_message_for_should.should =~ /Expected sent email cc/
end
it 'accepts sent e-mail based on cc list' do
should have_sent_email.with_cc(['you@you.com', 'joe@bob.com'])
matcher = have_sent_email.with_cc(['you@example.com'])
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with cc/
+ matcher.failure_message_for_should.should =~ /Expected sent email with cc/
end
it 'accepts sent e-mail based on bcc string' do
should have_sent_email.bcc('goodbye@hello.com')
matcher = have_sent_email.bcc('test@hello.com')
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email bcc/
+ matcher.failure_message_for_should.should =~ /Expected sent email bcc/
end
it 'accepts sent e-mail based on bcc regex' do
should have_sent_email.bcc(/@example\.com/)
matcher = have_sent_email.bcc(/you@/)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email bcc/
+ matcher.failure_message_for_should.should =~ /Expected sent email bcc/
end
it 'accepts sent e-mail based on bcc list' do
should have_sent_email.with_bcc(['sam@bob.com', 'test@example.com'])
matcher = have_sent_email.with_bcc(['you@you.com', 'joe@bob.com'])
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email with bcc/
+ matcher.failure_message_for_should.should =~ /Expected sent email with bcc/
end
it 'accepts sent-email when it is multipart' do
should have_sent_email.multipart
matcher = have_sent_email.multipart(false)
matcher.matches?(nil)
- matcher.failure_message.should =~ /Expected sent email not being multipart/
+ matcher.failure_message_for_should.should =~ /Expected sent email not being multipart/
end
it 'lists all the deliveries within failure message' do
@@ -254,7 +254,7 @@ def the_email(params)
matcher = have_sent_email.to('you@example.com')
matcher.matches?(nil)
- matcher.failure_message.should =~ /Deliveries:\n"This is spam" to \["myself@me\.com"\]\n"This is spam" to \["myself@me\.com"\]/
+ matcher.failure_message_for_should.should =~ /Deliveries:\n"This is spam" to \["myself@me\.com"\]\n"This is spam" to \["myself@me\.com"\]/
end
it 'allows chaining' do
View
2  spec/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb
@@ -70,7 +70,7 @@
matcher.matches?(no_protected_attributes).should be_true
- matcher.negative_failure_message.should_not be_nil
+ matcher.failure_message_for_should_not.should_not be_nil
end
end
View
2  spec/shoulda/matchers/active_model/allow_value_matcher_spec.rb
@@ -116,7 +116,7 @@
matcher.matches?(validating_format(:with => /abc/, :strict => true))
- matcher.negative_failure_message.should == 'Expected exception to include /abc/ ' +
+ matcher.failure_message_for_should_not.should == 'Expected exception to include /abc/ ' +
'when attr is set to "xyz", got Attr is invalid'
end
end
View
4 spec/shoulda/matchers/active_model/disallow_value_matcher_spec.rb
@@ -22,13 +22,13 @@
end
it "delegates its failure message to its allow matcher's negative failure message" do
- allow_matcher = stub_everything(:negative_failure_message => 'allow matcher failure')
+ allow_matcher = stub_everything(:failure_message_for_should_not => 'allow matcher failure')
Shoulda::Matchers::ActiveModel::AllowValueMatcher.stubs(:new).returns(allow_matcher)
matcher = matcher('abcde').for(:attr).with_message('good message')
matcher.matches?(validating_format(:with => /abc/, :message => 'good message'))
- matcher.failure_message.should == 'allow matcher failure'
+ matcher.failure_message_for_should.should == 'allow matcher failure'
end
it 'matches if the message is correct but the value is not' do
View
2  spec/shoulda/matchers/active_model/only_integer_matcher_spec.rb
@@ -38,7 +38,7 @@
matcher.matches?(define_model(:example, :attr => :string).new)
- matcher.failure_message.should include 'Expected errors to include "must be an integer"'
+ matcher.failure_message_for_should.should include 'Expected errors to include "must be an integer"'
end
end
View
4 spec/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb
@@ -27,7 +27,7 @@
the_matcher.matches?(define_model(:example, :attr => :string).new)
- the_matcher.failure_message.should include 'Expected errors to include "must be an integer"'
+ the_matcher.failure_message_for_should.should include 'Expected errors to include "must be an integer"'
end
end
@@ -45,7 +45,7 @@
the_matcher.matches?(validating_numericality)
- the_matcher.failure_message.should include 'Expected errors to include "must be an integer"'
+ the_matcher.failure_message_for_should.should include 'Expected errors to include "must be an integer"'
end
end
View
12 spec/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb
@@ -10,7 +10,7 @@
matcher.matches?(rejecting_children).should be_false
- matcher.failure_message.should == 'Expected Parent to accept nested attributes for children (is not declared)'
+ matcher.failure_message_for_should.should == 'Expected Parent to accept nested attributes for children (is not declared)'
end
context 'allow_destroy' do
@@ -31,7 +31,7 @@
matching = accepting_children(:allow_destroy => true)
matcher.allow_destroy(false).matches?(matching).should be_false
- matcher.failure_message.should =~ /should not allow destroy/
+ matcher.failure_message_for_should.should =~ /should not allow destroy/
end
it 'rejects an invalid falsey value' do
@@ -39,7 +39,7 @@
matching = accepting_children(:allow_destroy => false)
matcher.allow_destroy(true).matches?(matching).should be_false
- matcher.failure_message.should =~ /should allow destroy/
+ matcher.failure_message_for_should.should =~ /should allow destroy/
end
end
@@ -53,7 +53,7 @@
rejecting = accepting_children(:limit => 3)
matcher.limit(2).matches?(rejecting).should be_false
- matcher.failure_message.should =~ /limit should be 2, got 3/
+ matcher.failure_message_for_should.should =~ /limit should be 2, got 3/
end
end
@@ -73,7 +73,7 @@
rejecting = accepting_children(:update_only => true)
matcher.matches?(rejecting).should be_false
- matcher.failure_message.should =~ /should not be update only/
+ matcher.failure_message_for_should.should =~ /should not be update only/
end
it 'rejects an invalid falsey value' do
@@ -81,7 +81,7 @@
rejecting = accepting_children(:update_only => false)
matcher.matches?(rejecting).should be_false
- matcher.failure_message.should =~ /should be update only/
+ matcher.failure_message_for_should.should =~ /should be update only/
end
end
View
4 spec/shoulda/matchers/active_record/association_matcher_spec.rb
@@ -173,7 +173,7 @@ def belonging_to_parent(options = {})
matcher.matches?(having_many_children).should be_false
- matcher.failure_message.should =~ /does not have any relationship to conceptions/
+ matcher.failure_message_for_should.should =~ /does not have any relationship to conceptions/
end
it 'rejects an association that has the wrong :through option' do
@@ -190,7 +190,7 @@ def belonging_to_parent(options = {})
matcher = have_many(:children).through(:relationships)
matcher.matches?(Parent.new).should be_false
- matcher.failure_message.should =~ /through relationships, but got it through conceptions/
+ matcher.failure_message_for_should.should =~ /through relationships, but got it through conceptions/
end
it 'accepts an association with a valid :dependent option' do
View
2  spec/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb
@@ -29,7 +29,7 @@
matcher.matches?(model)
- matcher.failure_message.should_not be_nil
+ matcher.failure_message_for_should.should_not be_nil
end
end
View
6 spec/shoulda/matchers/active_record/serialize_matcher_spec.rb
@@ -15,7 +15,7 @@
matcher.matches?(unserialized_model)
- matcher.failure_message.should =~ /to serialize the attribute called :attr/
+ matcher.failure_message_for_should.should =~ /to serialize the attribute called :attr/
end
it 'assigns a helpful failure message when using #as' do
@@ -23,7 +23,7 @@
matcher.matches?(unserialized_model)
- matcher.failure_message.should =~ /with a type of Hash/
+ matcher.failure_message_for_should.should =~ /with a type of Hash/
end
it 'assigns a helpful failure message when using #as_instance_of' do
@@ -31,7 +31,7 @@
matcher.matches?(unserialized_model)
- matcher.failure_message.should =~ /with an instance of Hash/
+ matcher.failure_message_for_should.should =~ /with an instance of Hash/
end
def unserialized_model
View
8 spec/shoulda/matchers/independent/delegate_matcher_spec.rb
@@ -52,7 +52,7 @@ def deliver_mail
matcher.matches?(post_office)
message = 'Expected PostOffice#deliver_mail to delegate to PostOffice#mailman'
- matcher.failure_message.should == message
+ matcher.failure_message_for_should.should == message
end
it 'uses the proper syntax for class methods in errors' do
@@ -61,7 +61,7 @@ def deliver_mail
matcher.matches?(PostOffice)
message = 'Expected PostOffice.deliver_mail to delegate to PostOffice.mailman'
- matcher.failure_message.should == message
+ matcher.failure_message_for_should.should == message
end
end
@@ -116,7 +116,7 @@ def mailman
matcher.matches?(post_office)
message = 'Expected PostOffice#deliver_mail to delegate to PostOffice#mailman with arguments: ["123 Nowhere Ln."]'
- matcher.failure_message.should == message
+ matcher.failure_message_for_should.should == message
end
end
end
@@ -156,7 +156,7 @@ def mailman
matcher.matches?(post_office)
message = 'Expected PostOffice#deliver_mail to delegate to PostOffice#mailman as :watch_tv'
- matcher.failure_message.should == message
+ matcher.failure_message_for_should.should == message
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.