lib/shoulda/matchers/action_controller/callback_matcher.rb in shoulda-matchers-3.1.3 vs lib/shoulda/matchers/action_controller/callback_matcher.rb in shoulda-matchers-4.0.0.rc1

- old
+ new

@@ -18,14 +18,18 @@ # class UsersControllerTest < ActionController::TestCase # should use_before_filter(:authenticate_user!) # should_not use_before_filter(:prevent_ssl) # end # + # @note This method is only available when using shoulda-matchers under + # Rails 4.x. # @return [CallbackMatcher] # - def use_before_filter(callback) - CallbackMatcher.new(callback, :before, :filter) + if RailsShim.action_pack_lt_5? + def use_before_filter(callback) + CallbackMatcher.new(callback, :before, :filter) + end end # The `use_after_filter` matcher is used to test that an after_filter # callback is defined within your controller. # @@ -43,14 +47,18 @@ # class IssuesControllerTest < ActionController::TestCase # should use_after_filter(:log_activity) # should_not use_after_filter(:destroy_user) # end # + # @note This method is only available when using shoulda-matchers under + # Rails 4.x. # @return [CallbackMatcher] # - def use_after_filter(callback) - CallbackMatcher.new(callback, :after, :filter) + if RailsShim.action_pack_lt_5? + def use_after_filter(callback) + CallbackMatcher.new(callback, :after, :filter) + end end # The `use_before_action` matcher is used to test that a before_action # callback is defined within your controller. # @@ -118,13 +126,17 @@ # class ChangesControllerTest < ActionController::TestCase # should use_around_filter(:wrap_in_transaction) # should_not use_around_filter(:save_view_context) # end # + # @note This method is only available when using shoulda-matchers under + # Rails 4.x. # @return [CallbackMatcher] # - def use_around_filter(callback) - CallbackMatcher.new(callback, :around, :filter) + if RailsShim.action_pack_lt_5? + def use_around_filter(callback) + CallbackMatcher.new(callback, :around, :filter) + end end # The `use_around_action` matcher is used to test that an around_action # callback is defined within your controller. #