diff --git a/Changelog.md b/Changelog.md index b3392c12fd..ea999a7e59 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,7 +22,7 @@ Enhancements (Sam Phippen) * Support `{a,b}` shell expansion syntax in `--pattern` option (Konstantin Haase). -* Add cucumber documentation for --require commandline option +* Add cucumber documentation for --require command line option (Bradley Schaefer) Bug fixes @@ -51,6 +51,9 @@ Deprecations `Configuration#backtrace_exclusion_patterns` for greater consistency and symmetry with new `backtrace_inclusion_patterns` config option (Sam Phippen). +* Deprecate `Configuration#requires=` in favor of using ruby's + `require`. Requires specified by the command line can still be + accessed by the `Configuration#require` reader. (Bradley Schaefer) ### 2.13.1 / 2013-03-12 [full changelog](http://github.com/rspec/rspec-core/compare/v2.13.0...v2.13.1) diff --git a/features/command_line/require_option.feature b/features/command_line/require_option.feature index b00d8193f3..a07e325eca 100644 --- a/features/command_line/require_option.feature +++ b/features/command_line/require_option.feature @@ -4,17 +4,40 @@ Feature: --require option before running specs. Scenario: using the --require option - Given a file named "spec/foobarator.rb" with: + Given a file named "logging_formatter.rb" with: """ruby - class Foobarator; end + require "rspec/core/formatters/base_text_formatter" + require 'delegate' + + class LoggingFormatter < RSpec::Core::Formatters::BaseTextFormatter + def initialize(output) + super LoggingIO.new(output) + end + + class LoggingIO < SimpleDelegator + def initialize(output) + @file = File.new('rspec.log', 'w') + super + end + + def puts(message) + [@file, __getobj__].each { |out| out.puts message } + end + + def close + @file.close + end + end + end """ - And a file named "spec/foobarator_spec.rb" with: + And a file named "spec/example_spec.rb" with: """ruby - describe Foobarator do - it "exists" do - expect(defined?(Foobarator)).to be_true + describe "an embarassing situation" do + it "happens to everyone" do end end """ - When I run `rspec --require foobarator` + When I run `rspec --require ./logging_formatter.rb --format LoggingFormatter` Then the output should contain "1 example, 0 failures" + And the file "rspec.log" should contain "1 example, 0 failures" + And the exit status should be 0