From aca30e2f8c9087f2537658297d97dc19ca67f94b Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 4 Nov 2020 13:57:13 +1100 Subject: [PATCH] feat: remove runtime dependency on rspec --- lib/pact/rspec.rb | 5 ++--- pact-support.gemspec | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/pact/rspec.rb b/lib/pact/rspec.rb index 0fd4fd4..154d2ba 100644 --- a/lib/pact/rspec.rb +++ b/lib/pact/rspec.rb @@ -1,4 +1,3 @@ -require 'rspec' # This is horrible, must work out a better way of doing this module Pact module RSpec @@ -31,11 +30,11 @@ def self.runner_defined? end def self.is_rspec_3 - ::RSpec::Core::Formatters.respond_to?(:register) + defined?(::Rspec) && ::RSpec::Core::Formatters.respond_to?(:register) end def self.is_rspec_2 - !is_rspec_3 + defined?(::Rspec) && !is_rspec_3 end def self.with_rspec_3 diff --git a/pact-support.gemspec b/pact-support.gemspec index 9bbeb1a..f9c9af5 100644 --- a/pact-support.gemspec +++ b/pact-support.gemspec @@ -20,11 +20,11 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_runtime_dependency "randexp", "~> 0.1.7" - spec.add_runtime_dependency "rspec", ">= 2.14" spec.add_runtime_dependency "term-ansicolor", "~> 1.0" spec.add_runtime_dependency "awesome_print", "~> 1.1" spec.add_runtime_dependency "diff-lcs", "~> 1.4" + spec.add_development_dependency "rspec", ">= 2.14", "< 4.0" spec.add_development_dependency "rake", "~> 10.0.3" spec.add_development_dependency "webmock", "~> 3.3" spec.add_development_dependency "pry"