Skip to content

Commit

Permalink
Deprecate matchers for 2.0 release.
Browse files Browse the repository at this point in the history
* Deprecates matchers from issue thoughtbot#252:
* assign_to
* respond_with_content_type
* query_the_database
* validate_format_of
* have_sent_email
* strong_parameters_matcher
* delegate_method
  • Loading branch information
mxie authored and panupan committed Apr 10, 2013
1 parent ab98009 commit e802589
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/shoulda/matchers/action_controller/assign_to_matcher.rb
@@ -1,3 +1,5 @@
require 'active_support/deprecation'

module Shoulda # :nodoc:
module Matchers
module ActionController # :nodoc:
Expand All @@ -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
Expand Down
@@ -1,3 +1,5 @@
require 'active_support/deprecation'

module Shoulda # :nodoc:
module Matchers
module ActionController # :nodoc:
Expand All @@ -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

Expand Down
@@ -1,4 +1,5 @@
require 'bourne'
require 'active_support/deprecation'
begin
require 'strong_parameters'
rescue LoadError
Expand All @@ -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 = []
Expand Down
3 changes: 3 additions & 0 deletions 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:
Expand All @@ -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

Expand Down
@@ -1,3 +1,5 @@
require 'active_support/deprecation'

module Shoulda # :nodoc:
module Matchers
module ActiveModel # :nodoc:
Expand Down Expand Up @@ -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
Expand Down
@@ -1,3 +1,5 @@
require 'active_support/deprecation'

module Shoulda # :nodoc:
module Matchers
module ActiveRecord # :nodoc:
Expand All @@ -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 = {}

Expand Down
2 changes: 2 additions & 0 deletions lib/shoulda/matchers/independent/delegate_matcher.rb
@@ -1,4 +1,5 @@
require 'bourne'
require 'active_support/deprecation'

module Shoulda # :nodoc:
module Matchers
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e802589

Please sign in to comment.