Skip to content

Commit

Permalink
.rspec (instead of .rspecrc)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Apr 6, 2010
1 parent 026a6e2 commit beaf23b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
12 changes: 12 additions & 0 deletions README.markdown
Expand Up @@ -63,6 +63,18 @@ Use the documentation formatter to see the resulting spec:
Finished in 0.000379 seconds
1 example, 0 failures

## Configuration

You can define runtime configuration options in four places. They
are loaded and processed in this order:

* ~/.rspec
* .rspec
* RSpec.configure
* command line

Run `rspec --help` to see supported configuration options.

#### Also see

* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/core/command_line_options.rb
Expand Up @@ -5,8 +5,8 @@ module Rspec
module Core

class CommandLineOptions
LOCAL_OPTIONS_FILE = ".rspecrc"
GLOBAL_OPTIONS_FILE = File.join(File.expand_path("~"), ".rspecrc")
LOCAL_OPTIONS_FILE = ".rspec"
GLOBAL_OPTIONS_FILE = File.join(File.expand_path("~"), ".rspec")

attr_reader :args, :options

Expand Down Expand Up @@ -89,7 +89,7 @@ def local_options
def local_options_file
return @options.delete(:options_file) if @options[:options_file]
return LOCAL_OPTIONS_FILE if File.exist?(LOCAL_OPTIONS_FILE)
Rspec.deprecate("spec/spec.opts", ".rspecrc or ~/.rspecrc", "2.0.0") if File.exist?("spec/spec.opts")
Rspec.deprecate("spec/spec.opts", ".rspec or ~/.rspec", "2.0.0") if File.exist?("spec/spec.opts")
"spec/spec.opts"
end

Expand Down
2 changes: 1 addition & 1 deletion rspec-core.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Chad Humphries", "David Chelimsky"]
s.date = %q{2010-04-04}
s.date = %q{2010-04-06}
s.description = %q{Rspec runner and example group classes}
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
s.executables = ["rspec", "spec"]
Expand Down
10 changes: 5 additions & 5 deletions spec/rspec/core/command_line_options_spec.rb
Expand Up @@ -105,13 +105,13 @@ def options_from_args(*args)
config.formatter.should == 'doc'
end

it "merges options from the global and local .rspecrc and the command line" do
it "merges options from the global and local .rspec and the command line" do
File.stub(:exist?){ true }
File.stub(:readlines) do |path|
case path
when ".rspecrc"
when ".rspec"
["--formatter", "documentation"]
when /\.rspecrc/
when /\.rspec/
["--line", "37"]
else
raise "Unexpected path: #{path}"
Expand All @@ -130,9 +130,9 @@ def options_from_args(*args)
File.stub(:exist?){ true }
File.stub(:readlines) do |path|
case path
when ".rspecrc"
when ".rspec"
["--formatter", "local"]
when /\.rspecrc/
when /\.rspec/
["--formatter", "global"]
else
raise "Unexpected path: #{path}"
Expand Down

0 comments on commit beaf23b

Please sign in to comment.