Skip to content
This repository
tree: 8d5976626e
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 68 lines (59 sloc) 2.015 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
Feature: spec/spec.opts

For backwards compatibility with rspec-1, you can write command
line options in a spec/spec.opts file and it will be loaded
automatically.

Options declared in spec/spec.opts will override configuration
set up in RSpec.configure blocks.

Scenario: color set in RSpec.configure
Given a file named "spec/example_spec.rb" with:
"""
RSpec.configure {|c| c.color_enabled = true }

describe "color_enabled" do
context "when set with RSpec.configure" do
it "is true" do
RSpec.configuration.color_enabled?.should be_true
end
end
end
"""
When I run "rspec ./spec/example_spec.rb"
Then the output should contain "1 example, 0 failures"
Scenario: color set in .rspec
Given a file named ".rspec" with:
"""
--color
"""
And a file named "spec/example_spec.rb" with:
"""
describe "color_enabled" do
context "when set with RSpec.configure" do
it "is true" do
RSpec.configuration.color_enabled?.should be_true
end
end
end
"""
When I run "rspec ./spec/example_spec.rb"
Then the output should contain "1 example, 0 failures"

Scenario: formatter set in both (RSpec.configure wins)
Given a file named ".rspec" with:
"""
--format progress
"""
And a file named "spec/spec_helper.rb" with:
"""
RSpec.configure {|c| c.formatter = 'documentation'}
"""
And a file named "spec/example_spec.rb" with:
"""
require "spec_helper"

describe "formatter" do
context "when set with RSpec.configure and in spec.opts" do
it "takes the value set in spec.opts" do
RSpec.configuration.formatter.should be_an(RSpec::Core::Formatters::DocumentationFormatter)
end
end
end
"""
When I run "rspec ./spec/example_spec.rb"
Then the output should contain "1 example, 0 failures"

Something went wrong with that request. Please try again.