diff --git a/lib/rspec-rails-caching/matchers/base.rb b/lib/rspec-rails-caching/matchers/base.rb index deefcdc..fbbd79f 100644 --- a/lib/rspec-rails-caching/matchers/base.rb +++ b/lib/rspec-rails-caching/matchers/base.rb @@ -13,16 +13,16 @@ def self.caching_matcher name, &block "#{cache_or_expire} #{expected.inspect}" end - failure_message_for_should_not do |actual| + failure_message_when_negated do |actual| "Expected #{controller.class} not to #{cache_or_expire} #{expected.inspect} but got #{cache_results.inspect}" end - failure_message_for_should do |actual| + failure_message do |actual| "Expected #{controller.class} to #{cache_or_expire} #{expected.inspect} but got #{cache_results.inspect}" end - def controller - matcher_execution_context.controller + def supports_block_expectations? + true end def cache_store @@ -37,7 +37,7 @@ def cache_or_expire fail NoMethodError, "Abstract method 'cache_or_expire' to be defined in matcher" end - instance_eval &block + module_eval &block end end diff --git a/rspec-rails-caching.gemspec b/rspec-rails-caching.gemspec index 5492332..6468e55 100644 --- a/rspec-rails-caching.gemspec +++ b/rspec-rails-caching.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |gem| gem.required_ruby_version = Gem::Requirement.new(">= 2.0.0") gem.add_dependency "rails", ">=3.0.0" - gem.add_dependency "rspec", ">=2.8.0" - gem.add_dependency "rspec-rails", ">=2.10.0" + gem.add_dependency "rspec", ">=3.0.0" + gem.add_dependency "rspec-rails", ">=3.0.0" gem.files = `git ls-files`.split($\) gem.test_files = gem.files.grep(%r{^(test|spec|features)/})