Skip to content

Commit

Permalink
Improve --require docs with something more useful
Browse files Browse the repository at this point in the history
Add deprecation to changelog
  • Loading branch information
soulcutter committed Apr 13, 2013
1 parent 0538549 commit 887f9b9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Changelog.md
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
37 changes: 30 additions & 7 deletions features/command_line/require_option.feature
Expand Up @@ -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

0 comments on commit 887f9b9

Please sign in to comment.