diff --git a/lib/rspec-puppet/matchers/compile.rb b/lib/rspec-puppet/matchers/compile.rb index c5242229..d1de5454 100644 --- a/lib/rspec-puppet/matchers/compile.rb +++ b/lib/rspec-puppet/matchers/compile.rb @@ -67,12 +67,6 @@ def failure_message_when_negated "expected that the catalogue would not compile but it does" end - if RSpec::Version::STRING < '3' - # RSpec 2 compatibility: - alias_method :failure_message_for_should, :failure_message - alias_method :failure_message_for_should_not, :failure_message_when_negated - end - private def missing_dependencies? retval = false diff --git a/lib/rspec-puppet/matchers/count_generic.rb b/lib/rspec-puppet/matchers/count_generic.rb index d4fd1f8f..2d4e3277 100644 --- a/lib/rspec-puppet/matchers/count_generic.rb +++ b/lib/rspec-puppet/matchers/count_generic.rb @@ -57,12 +57,6 @@ def failure_message_when_negated "expected that the catalogue would not " + description + " but it does" end - if RSpec::Version::STRING < '3' - # RSpec 2 compatibility: - alias_method :failure_message_for_should, :failure_message - alias_method :failure_message_for_should_not, :failure_message_when_negated - end - private def referenced_type(type) diff --git a/lib/rspec-puppet/matchers/create_generic.rb b/lib/rspec-puppet/matchers/create_generic.rb index 37880f23..af93426e 100644 --- a/lib/rspec-puppet/matchers/create_generic.rb +++ b/lib/rspec-puppet/matchers/create_generic.rb @@ -113,12 +113,6 @@ def failure_message_when_negated "expected that the catalogue would not contain #{@referenced_type}[#{@title}]#{errors}" end - if RSpec::Version::STRING < '3' - # RSpec 2 compatibility: - alias_method :failure_message_for_should, :failure_message - alias_method :failure_message_for_should_not, :failure_message_when_negated - end - def description values = [] value_str_prefix = "with" diff --git a/lib/rspec-puppet/matchers/run.rb b/lib/rspec-puppet/matchers/run.rb index aea26786..8eb78ec0 100644 --- a/lib/rspec-puppet/matchers/run.rb +++ b/lib/rspec-puppet/matchers/run.rb @@ -89,12 +89,6 @@ def failure_message_when_negated failure_message_generic(:should_not, @func_obj) end - if RSpec::Version::STRING < '3' - # RSpec 2 compatibility: - alias_method :failure_message_for_should, :failure_message - alias_method :failure_message_for_should_not, :failure_message_when_negated - end - def description "run #{func_name}(#{func_params}) and #{@desc}" end diff --git a/lib/rspec-puppet/support.rb b/lib/rspec-puppet/support.rb index 4eba9d88..f5332fe6 100644 --- a/lib/rspec-puppet/support.rb +++ b/lib/rspec-puppet/support.rb @@ -198,5 +198,13 @@ def build_node(name, opts = {}) opts.merge!({:environment => node_environment}) Puppet::Node.new(name, opts) end + + def rspec_compatibility + if RSpec::Version::STRING < '3' + # RSpec 2 compatibility: + alias_method :failure_message_for_should, :failure_message + alias_method :failure_message_for_should_not, :failure_message_when_negated + end + end end end