Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Deprecate matchers for 2.0 release.

* Deprecates matchers from issue #252:
* assign_to
* respond_with_content_type
* query_the_database
* validate_format_of
* have_sent_email
* strong_parameters_matcher
* delegate_method
  • Loading branch information...
commit 6091663b490ee294b0d8ad3e6adfebca8c0e8ab1 1 parent db4e2eb
@mxie mxie authored
View
3  lib/shoulda/matchers/action_controller/assign_to_matcher.rb
@@ -1,3 +1,5 @@
+require 'active_support/deprecation'
@gabebw Owner
gabebw added a note

This should only have to be required once, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
module Shoulda # :nodoc:
module Matchers
module ActionController # :nodoc:
@@ -22,6 +24,7 @@ class AssignToMatcher # :nodoc:
attr_reader :failure_message_for_should, :failure_message_for_should_not
def initialize(variable)
+ ActiveSupport::Deprecation.warn 'The assign_to matcher is deprecated and will be removed in 2.0'
@variable = variable.to_s
@options = {}
@options[:check_value] = false
View
3  lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb
@@ -1,3 +1,5 @@
+require 'active_support/deprecation'
+
module Shoulda # :nodoc:
module Matchers
module ActionController # :nodoc:
@@ -23,6 +25,7 @@ def respond_with_content_type(content_type)
class RespondWithContentTypeMatcher # :nodoc:
def initialize(content_type)
+ ActiveSupport::Deprecation.warn 'The respond_with_content_type matcher is deprecated and will be removed in 2.0'
@content_type = look_up_content_type(content_type)
end
View
2  lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb
@@ -1,4 +1,5 @@
require 'bourne'
+require 'active_support/deprecation'
begin
require 'strong_parameters'
rescue LoadError
@@ -14,6 +15,7 @@ def permit(*attributes)
class StrongParametersMatcher
def initialize(*attributes_and_context)
+ ActiveSupport::Deprecation.warn 'The strong_parameters matcher is deprecated and will be removed in 2.0'
@attributes = attributes_and_context[0...-1]
@context = attributes_and_context.last
@permitted_params = []
View
3  lib/shoulda/matchers/action_mailer/have_sent_email_matcher.rb
@@ -1,3 +1,5 @@
+require 'active_support/deprecation'
+
module Shoulda # :nodoc:
module Matchers
module ActionMailer # :nodoc:
@@ -24,6 +26,7 @@ def have_sent_email
class HaveSentEmailMatcher # :nodoc:
def initialize(context)
+ ActiveSupport::Deprecation.warn 'The have_sent_email matcher is deprecated and will be removed in 2.0'
@context = context
end
View
3  lib/shoulda/matchers/active_model/validate_format_of_matcher.rb
@@ -1,3 +1,5 @@
+require 'active_support/deprecation'
+
module Shoulda # :nodoc:
module Matchers
module ActiveModel # :nodoc:
@@ -27,6 +29,7 @@ def validate_format_of(attr)
class ValidateFormatOfMatcher < ValidationMatcher # :nodoc:
def initialize(attribute)
+ ActiveSupport::Deprecation.warn 'The validate_format_of matcher is deprecated and will be removed in 2.0'
super
@options = {}
end
View
3  lib/shoulda/matchers/active_record/query_the_database_matcher.rb
@@ -1,3 +1,5 @@
+require 'active_support/deprecation'
+
module Shoulda # :nodoc:
module Matchers
module ActiveRecord # :nodoc:
@@ -20,6 +22,7 @@ def query_the_database(times = nil)
class QueryTheDatabaseMatcher # :nodoc:
def initialize(times)
+ ActiveSupport::Deprecation.warn 'The query_the_database matcher is deprecated and will be removed in 2.0'
@queries = []
@options = {}
View
2  lib/shoulda/matchers/independent/delegate_matcher.rb
@@ -1,4 +1,5 @@
require 'bourne'
+require 'active_support/deprecation'
module Shoulda # :nodoc:
module Matchers
@@ -26,6 +27,7 @@ def delegate_method(delegating_method)
class DelegateMatcher
def initialize(delegating_method)
+ ActiveSupport::Deprecation.warn 'The delegate_method matcher is deprecated and will be removed in 2.0'
@delegating_method = delegating_method
end

2 comments on commit 6091663

@cbandy

Should there be tests for this new behavior?

@drapergeek
Owner

This isn't really new behavior, its just a warning. We tested visually, I don't think it is necessary to add test infrastructure.

Please sign in to comment.
Something went wrong with that request. Please try again.