From c2c3475f1144f298b41eed76792a7e634f4caf75 Mon Sep 17 00:00:00 2001 From: xdite Date: Sun, 27 Jul 2014 22:54:07 +0800 Subject: [PATCH] Fix for rspec3 with spork --- lib/spork/test_framework/rspec.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/spork/test_framework/rspec.rb b/lib/spork/test_framework/rspec.rb index d492e1c..2c3efd5 100644 --- a/lib/spork/test_framework/rspec.rb +++ b/lib/spork/test_framework/rspec.rb @@ -1,3 +1,5 @@ +require 'rspec/core' + class Spork::TestFramework::RSpec < Spork::TestFramework DEFAULT_PORT = 8989 HELPER_FILE = File.join(Dir.pwd, "spec/spec_helper.rb") @@ -7,12 +9,20 @@ def run_tests(argv, stderr, stdout) ::Spec::Runner::CommandLine.run( ::Spec::Runner::OptionParser.parse(argv, stderr, stdout) ) + elsif rspec3? + options = ::RSpec::Core::ConfigurationOptions.new(argv) + ::RSpec::Core::Runner.new(options).run(stderr, stdout) else ::RSpec::Core::CommandLine.new(argv).run(stderr, stdout) end end + def rspec3? + return false if !defined?(::RSpec::Core::Version::STRING) + ::RSpec::Core::Version::STRING =~ /^3\./ + end + def rspec1? defined?(Spec) && !defined?(RSpec) end -end +end \ No newline at end of file