diff --git a/History.markdown b/History.markdown index 95bdc53a94..b3a2929ecb 100644 --- a/History.markdown +++ b/History.markdown @@ -1,5 +1,15 @@ ## rspec-core release history (incomplete) +### 2.2.1 / in development + +[full changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...master) + +* Bug fixes + * alias_method instead of override Kernel#method_missing (John Wilger) + * changed --autotest to --tty in generated command (MIKAMI Yoshiyuki) + * revert change to debugger (had introduced conflict with Rails) + * also restored --debugger/-debug option + ### 2.2.0 / 2010-11-28 [full changelog](http://github.com/rspec/rspec-core/compare/v2.1.0...v2.2.0) diff --git a/Upgrade.markdown b/Upgrade.markdown index 4fb4ce942b..4fde130d58 100644 --- a/Upgrade.markdown +++ b/Upgrade.markdown @@ -1,4 +1,4 @@ -# rspec-core-2.2 (in development) +# rspec-core-2.2 ## FASTER! @@ -94,7 +94,7 @@ JRuby installation to a newer release that allows the example to pass, RSpec will report it as a failure (`Expected pending '...' to fail. No Error was raised.`), so that know that you can remove the call to `pending`. -# rspec-core-2.0 +# New features in rspec-core-2.0 ### Runner diff --git a/lib/autotest/rspec2.rb b/lib/autotest/rspec2.rb index 8c8728d1b5..c61772ac63 100644 --- a/lib/autotest/rspec2.rb +++ b/lib/autotest/rspec2.rb @@ -41,7 +41,7 @@ def consolidate_failures(failed) def make_test_cmd(files_to_test) files_to_test.empty? ? '' : - "#{bundle_exec}#{ruby} #{require_rubygems}-S #{SPEC_PROGRAM} --autotest #{normalize(files_to_test).keys.flatten.map { |f| "'#{f}'"}.join(' ')}" + "#{bundle_exec}#{ruby} #{require_rubygems}-S #{SPEC_PROGRAM} --tty #{normalize(files_to_test).keys.flatten.map { |f| "'#{f}'"}.join(' ')}" end def bundle_exec diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index fbc22073ea..180be43048 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -176,11 +176,21 @@ def requires=(paths) end def debug=(bool) - RSpec.warn_deprecation <<-WARNING -The debug option (config.debug = true or --debug/-d on the command line) -is deprecated and no longer has any effect. This message will be removed -from future versions of RSpec. -WARNING + return unless bool + begin + require 'ruby-debug' + rescue LoadError + raise <<-EOM + +#{'*'*50} +You must install ruby-debug to run rspec with the --debug option. + +If you have ruby-debug installed as a ruby gem, then you need to either +require 'rubygems' or configure the RUBYOPT environment variable with +the value 'rubygems'. +#{'*'*50} +EOM + end end def line_number=(line_number) diff --git a/lib/rspec/core/extensions/kernel.rb b/lib/rspec/core/extensions/kernel.rb index c7587ce54e..ae40361495 100644 --- a/lib/rspec/core/extensions/kernel.rb +++ b/lib/rspec/core/extensions/kernel.rb @@ -1,25 +1,5 @@ module Kernel - - private - - def method_missing(m, *a) - if m.to_s == 'debugger' - begin - require 'ruby-debug' - debugger - rescue LoadError => e - warn <<-EOM -#{'*'*50} -The debugger statement on the following line was ignored: - - #{caller(0).detect {|l| l !~ /method_missing/}} - -To use the debugger statement, you must install ruby-debug. -#{'*'*50} -EOM - end - else - super - end - end + def debugger(*args) + RSpec.configuration.error_stream.puts "debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}" + end unless respond_to?(:debugger) end diff --git a/lib/rspec/core/version.rb b/lib/rspec/core/version.rb index 97bbeb03ab..48fdae2048 100644 --- a/lib/rspec/core/version.rb +++ b/lib/rspec/core/version.rb @@ -1,7 +1,7 @@ module RSpec # :nodoc: module Core # :nodoc: module Version # :nodoc: - STRING = '2.2.0' + STRING = '2.2.1' end end end diff --git a/spec/autotest/rspec_spec.rb b/spec/autotest/rspec_spec.rb index 5d542453d8..f71e16f992 100644 --- a/spec/autotest/rspec_spec.rb +++ b/spec/autotest/rspec_spec.rb @@ -39,6 +39,12 @@ cmd.should match(/'#{File.expand_path(file_to_test)}'/) end end + + it "gives '--tty' to #{Autotest::Rspec2::SPEC_PROGRAM}, not '--autotest'" do + cmd = rspec_autotest.make_test_cmd(@files_to_test) + cmd.should match(' --tty ') + cmd.should_not match(' --autotest ') + end end describe "mappings" do diff --git a/spec/rspec/core/configuration_spec.rb b/spec/rspec/core/configuration_spec.rb index 44435e6922..7b90ed3a72 100644 --- a/spec/rspec/core/configuration_spec.rb +++ b/spec/rspec/core/configuration_spec.rb @@ -503,13 +503,20 @@ def that_thing end end - describe "#debug=" do - it "is deprecated" do - RSpec.should_receive(:warn_deprecation) + describe "#debug=true" do + it "requires 'ruby-debug'" do + config.should_receive(:require).with('ruby-debug') config.debug = true end end + describe "#debug=false" do + it "does not require 'ruby-debug'" do + config.should_not_receive(:require).with('ruby-debug') + config.debug = false + end + end + describe "#output=" do it "sets the output" do output = mock("output") diff --git a/spec/rspec/core/kernel_extensions_spec.rb b/spec/rspec/core/kernel_extensions_spec.rb index dd72a63dc0..dc59d7eecd 100644 --- a/spec/rspec/core/kernel_extensions_spec.rb +++ b/spec/rspec/core/kernel_extensions_spec.rb @@ -1,12 +1,9 @@ require 'spec_helper' describe "extensions" do - describe "#debugger" do - it "warns if ruby-debug is not installed" do - object = Object.new - object.should_receive(:warn).with(/debugger .* ignored:\n.* ruby-debug/m) - object.stub(:require) { raise LoadError } - object.__send__ :method_missing, :debugger + describe "debugger" do + it "is defined on Kernel" do + Kernel.should respond_to(:debugger) end end end