rspec-core 2.0.0.beta.8 → 2.0.0.beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +8 -8
- data/Rakefile +9 -9
- data/Upgrade.markdown +6 -6
- data/VERSION +1 -1
- data/cucumber.yml +2 -7
- data/example_specs/passing/subject_example.rb +45 -0
- data/example_specs/spec_helper.rb +1 -1
- data/features/command_line/line_number_appended_to_path.feature +11 -13
- data/features/command_line/line_number_option.feature +3 -3
- data/features/configuration/custom_options.feature +71 -0
- data/features/configuration/options_file.feature +13 -13
- data/features/example_groups/describe_aliases.feature +1 -1
- data/features/example_groups/nested_groups.feature +4 -5
- data/features/filtering/inclusion_filters.feature +74 -0
- data/features/formatters/custom_formatter.feature +1 -1
- data/features/hooks/around_hook.feature +1 -1
- data/features/hooks/before_and_after_hooks.feature +61 -33
- data/features/hooks/described_class.feature +1 -1
- data/features/hooks/halt.feature +2 -2
- data/features/mock_framework_integration/use_flexmock.feature +2 -2
- data/features/mock_framework_integration/use_mocha.feature +2 -2
- data/features/mock_framework_integration/use_rr.feature +2 -2
- data/features/mock_framework_integration/use_rspec.feature +2 -2
- data/features/pending/pending_examples.feature +5 -5
- data/features/subject/explicit_subject.feature +4 -4
- data/features/subject/implicit_subject.feature +2 -2
- data/features/support/env.rb +1 -1
- data/lib/autotest/rspec2.rb +1 -1
- data/lib/rspec/autorun.rb +1 -1
- data/lib/rspec/core.rb +16 -9
- data/lib/rspec/core/around_proxy.rb +1 -1
- data/lib/rspec/core/backward_compatibility.rb +29 -1
- data/lib/rspec/core/configuration.rb +24 -16
- data/lib/rspec/core/configuration_options.rb +2 -2
- data/lib/rspec/core/deprecation.rb +3 -3
- data/lib/rspec/core/errors.rb +1 -1
- data/lib/rspec/core/example.rb +10 -3
- data/lib/rspec/core/example_group.rb +83 -58
- data/lib/rspec/core/formatters.rb +1 -1
- data/lib/rspec/core/formatters/base_formatter.rb +4 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +3 -3
- data/lib/rspec/core/formatters/documentation_formatter.rb +6 -9
- data/lib/rspec/core/formatters/helpers.rb +5 -4
- data/lib/rspec/core/formatters/progress_formatter.rb +1 -1
- data/lib/rspec/core/hooks.rb +1 -1
- data/lib/rspec/core/kernel_extensions.rb +3 -23
- data/lib/rspec/core/let.rb +73 -5
- data/lib/rspec/core/load_path.rb +1 -1
- data/lib/rspec/core/metadata.rb +20 -8
- data/lib/rspec/core/mocking/with_absolutely_nothing.rb +1 -1
- data/lib/rspec/core/mocking/with_flexmock.rb +1 -1
- data/lib/rspec/core/mocking/with_mocha.rb +1 -1
- data/lib/rspec/core/mocking/with_rr.rb +2 -2
- data/lib/rspec/core/mocking/with_rspec.rb +3 -3
- data/lib/rspec/core/object_extensions.rb +15 -0
- data/lib/rspec/core/pending.rb +2 -2
- data/lib/rspec/core/rake_task.rb +2 -2
- data/lib/rspec/core/ruby_project.rb +1 -1
- data/lib/rspec/core/runner.rb +13 -8
- data/lib/rspec/core/shared_example_group.rb +16 -6
- data/lib/rspec/core/subject.rb +23 -7
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +45 -38
- data/rspec-core.gemspec +17 -11
- data/spec/autotest/failed_results_re_spec.rb +1 -1
- data/spec/rspec/core/configuration_options_spec.rb +17 -7
- data/spec/rspec/core/configuration_spec.rb +46 -18
- data/spec/rspec/core/deprecations_spec.rb +8 -0
- data/spec/rspec/core/example_group_spec.rb +194 -56
- data/spec/rspec/core/example_spec.rb +18 -6
- data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -2
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +18 -2
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +29 -4
- data/spec/rspec/core/formatters/helpers_spec.rb +18 -11
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +2 -2
- data/spec/rspec/core/kernel_extensions_spec.rb +5 -9
- data/spec/rspec/core/metadata_spec.rb +29 -8
- data/spec/rspec/core/pending_example_spec.rb +7 -7
- data/spec/rspec/core/ruby_project_spec.rb +1 -1
- data/spec/rspec/core/runner_spec.rb +9 -9
- data/spec/rspec/core/shared_example_group_spec.rb +3 -3
- data/spec/rspec/core/subject_spec.rb +1 -1
- data/spec/rspec/core/world_spec.rb +16 -35
- data/spec/rspec/core_spec.rb +9 -9
- data/spec/spec_helper.rb +11 -13
- data/spec/support/matchers.rb +2 -2
- data/specs.watchr +11 -11
- metadata +16 -10
data/README.markdown
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# RSpec Core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Driven Development and Test Driven Development.
|
|
3
|
+
Behaviour Driven Development for Ruby
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
## Upgrading from rspec-1.x
|
|
6
|
+
|
|
7
|
+
See Upgrade.markdown
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
gem install rspec --prerelease
|
|
12
12
|
|
|
13
13
|
This will install the rspec, rspec-core, rspec-expectations and rspec-mocks
|
|
14
14
|
gems.
|
|
@@ -16,7 +16,7 @@ gems.
|
|
|
16
16
|
## Get Started
|
|
17
17
|
|
|
18
18
|
Start with a simple example of behavior you expect from your system. Do
|
|
19
|
-
this before you write any code:
|
|
19
|
+
this before you write any implementation code:
|
|
20
20
|
|
|
21
21
|
# in spec/calculator_spec.rb
|
|
22
22
|
describe Calculator, "add" do
|
|
@@ -42,7 +42,7 @@ Implement the simplest solution:
|
|
|
42
42
|
Be sure to require the implementation file in the spec:
|
|
43
43
|
|
|
44
44
|
# in spec/calculator_spec.rb
|
|
45
|
-
# -
|
|
45
|
+
# - RSpec adds ./lib to the $LOAD_PATH, so you can
|
|
46
46
|
# just require "calculator" directly
|
|
47
47
|
require "calculator"
|
|
48
48
|
|
data/Rakefile
CHANGED
|
@@ -13,15 +13,15 @@ begin
|
|
|
13
13
|
require 'jeweler'
|
|
14
14
|
Jeweler::Tasks.new do |gem|
|
|
15
15
|
gem.name = "rspec-core"
|
|
16
|
-
gem.version =
|
|
17
|
-
gem.summary = "rspec-core-#{
|
|
18
|
-
gem.description = '
|
|
16
|
+
gem.version = RSpec::Core::Version::STRING
|
|
17
|
+
gem.summary = "rspec-core-#{RSpec::Core::Version::STRING}"
|
|
18
|
+
gem.description = 'RSpec runner and example group classes'
|
|
19
19
|
gem.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
|
|
20
20
|
gem.homepage = "http://github.com/rspec/core"
|
|
21
21
|
gem.authors = ["Chad Humphries", "David Chelimsky"]
|
|
22
22
|
gem.rubyforge_project = "rspec"
|
|
23
|
-
gem.add_development_dependency "rspec-expectations", ">= #{
|
|
24
|
-
gem.add_development_dependency "rspec-mocks", ">= #{
|
|
23
|
+
gem.add_development_dependency "rspec-expectations", ">= #{RSpec::Core::Version::STRING}"
|
|
24
|
+
gem.add_development_dependency "rspec-mocks", ">= #{RSpec::Core::Version::STRING}"
|
|
25
25
|
gem.add_development_dependency('cucumber', '>= 0.5.3')
|
|
26
26
|
gem.add_development_dependency('autotest', '>= 4.2.9')
|
|
27
27
|
gem.post_install_message = <<-EOM
|
|
@@ -43,14 +43,14 @@ end
|
|
|
43
43
|
namespace :gem do
|
|
44
44
|
desc "push to gemcutter"
|
|
45
45
|
task :push => :build do
|
|
46
|
-
system "gem push pkg/rspec-core-#{
|
|
46
|
+
system "gem push pkg/rspec-core-#{RSpec::Core::Version::STRING}.gem"
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
51
51
|
|
|
52
52
|
desc "Run all examples using rcov"
|
|
53
|
-
|
|
53
|
+
RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
|
|
54
54
|
t.rcov = true
|
|
55
55
|
t.rcov_opts = %[-Ilib -Ispec --exclude "mocks,expectations,gems/*,spec/resources,spec/lib,spec/spec_helper.rb,db/*,/Library/Ruby/*,config/*"]
|
|
56
56
|
t.rcov_opts << %[--no-html --aggregate coverage.data]
|
|
@@ -85,7 +85,7 @@ end
|
|
|
85
85
|
|
|
86
86
|
Rake::RDocTask.new do |rdoc|
|
|
87
87
|
rdoc.rdoc_dir = 'rdoc'
|
|
88
|
-
rdoc.title = "rspec-core #{
|
|
88
|
+
rdoc.title = "rspec-core #{RSpec::Core::Version::STRING}"
|
|
89
89
|
rdoc.rdoc_files.include('README*')
|
|
90
90
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
91
91
|
end
|
data/Upgrade.markdown
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## What's changed
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### RSpec namespace
|
|
6
6
|
|
|
7
|
-
The root namespace is now `
|
|
7
|
+
The root namespace is now `RSpec` instead of `Spec`, and the root directory
|
|
8
8
|
under `lib` is `rspec` instead of `spec`.
|
|
9
9
|
|
|
10
10
|
### Configuration
|
|
11
11
|
|
|
12
12
|
Typically in `spec/spec_helper.rb`, configuration is now done like this:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
RSpec.configure do |c|
|
|
15
15
|
# ....
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ each example in a variety of ways.
|
|
|
38
38
|
The most obvious use is for filtering the run. For example:
|
|
39
39
|
|
|
40
40
|
# in spec/spec_helper.rb
|
|
41
|
-
|
|
41
|
+
RSpec.configure do |c|
|
|
42
42
|
c.filter_run :focus => true
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ When you run the `rspec` command, rspec will run only the examples that have
|
|
|
54
54
|
|
|
55
55
|
You can also add `run_all_when_everything_filtered` to the config:
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
RSpec.configure do |c|
|
|
58
58
|
c.filter_run :focus => true
|
|
59
59
|
c.run_all_when_everything_filtered = true
|
|
60
60
|
end
|
|
@@ -72,7 +72,7 @@ rspec-core, and here's how we're getting the right stuff to run under the
|
|
|
72
72
|
right version:
|
|
73
73
|
|
|
74
74
|
# in spec/spec_helper.rb
|
|
75
|
-
|
|
75
|
+
RSpec.configure do |c|
|
|
76
76
|
c.exclusion_filter = { :ruby => lambda {|version|
|
|
77
77
|
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
|
|
78
78
|
}}
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.0.beta.
|
|
1
|
+
2.0.0.beta.9
|
data/cucumber.yml
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
|
4
|
-
std_opts = "#{rerun_opts} --require features --format rerun --out rerun.txt --strict --tags ~@wip"
|
|
5
|
-
%>
|
|
6
|
-
default: <%= std_opts %>
|
|
7
|
-
wip: --require features --tags @wip:3 --wip features
|
|
1
|
+
default: --require features --strict --format progress --tags ~@wip features
|
|
2
|
+
wip: --require features --tags @wip:3 --wip features
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
module SubjectExample
|
|
4
|
+
class OneThing
|
|
5
|
+
attr_accessor :what_things_do
|
|
6
|
+
def initialize
|
|
7
|
+
self.what_things_do = "stuff"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# implicit subject
|
|
12
|
+
describe OneThing do
|
|
13
|
+
it "should do what things do" do
|
|
14
|
+
subject.what_things_do.should == "stuff"
|
|
15
|
+
end
|
|
16
|
+
it "should be a OneThing" do
|
|
17
|
+
should == subject
|
|
18
|
+
end
|
|
19
|
+
its(:what_things_do) { should == "stuff" }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# explicit subject
|
|
23
|
+
describe SubjectExample::OneThing do
|
|
24
|
+
subject { SubjectExample::OneThing.new }
|
|
25
|
+
it "should do what things do" do
|
|
26
|
+
subject.what_things_do.should == "stuff"
|
|
27
|
+
end
|
|
28
|
+
it "should be a OneThing" do
|
|
29
|
+
should == subject
|
|
30
|
+
end
|
|
31
|
+
its(:what_things_do) { should == "stuff" }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# modified subject
|
|
35
|
+
describe OneThing do
|
|
36
|
+
subject { SubjectExample::OneThing.new }
|
|
37
|
+
before { subject.what_things_do = "more stuff" }
|
|
38
|
+
it "should do what things do" do
|
|
39
|
+
subject.what_things_do.should == "more stuff"
|
|
40
|
+
end
|
|
41
|
+
its(:what_things_do) { should == "more stuff" }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
@@ -28,80 +28,78 @@ Feature: line number appended to file path
|
|
|
28
28
|
end
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
-
@wip
|
|
32
31
|
Scenario: nested groups - outer group on declaration line
|
|
33
|
-
When I run "rspec example_spec.rb:1 --format doc"
|
|
32
|
+
When I run "rspec ./example_spec.rb:1 --format doc"
|
|
34
33
|
Then I should see "3 examples, 0 failures"
|
|
35
34
|
And I should see "second example in outer group"
|
|
36
35
|
And I should see "first example in outer group"
|
|
37
36
|
And I should see "example in nested group"
|
|
38
37
|
|
|
39
|
-
@wip
|
|
40
38
|
Scenario: nested groups - outer group inside block before example
|
|
41
|
-
When I run "rspec example_spec.rb:2 --format doc"
|
|
39
|
+
When I run "rspec ./example_spec.rb:2 --format doc"
|
|
42
40
|
Then I should see "3 examples, 0 failures"
|
|
43
41
|
And I should see "second example in outer group"
|
|
44
42
|
And I should see "first example in outer group"
|
|
45
43
|
And I should see "example in nested group"
|
|
46
44
|
|
|
47
45
|
Scenario: nested groups - inner group on declaration line
|
|
48
|
-
When I run "rspec example_spec.rb:11 --format doc"
|
|
46
|
+
When I run "rspec ./example_spec.rb:11 --format doc"
|
|
49
47
|
Then I should see "1 example, 0 failures"
|
|
50
48
|
And I should see "example in nested group"
|
|
51
49
|
And I should not see "second example in outer group"
|
|
52
50
|
And I should not see "first example in outer group"
|
|
53
51
|
|
|
54
52
|
Scenario: nested groups - inner group inside block before example
|
|
55
|
-
When I run "rspec example_spec.rb:12 --format doc"
|
|
53
|
+
When I run "rspec ./example_spec.rb:12 --format doc"
|
|
56
54
|
Then I should see "1 example, 0 failures"
|
|
57
55
|
And I should see "example in nested group"
|
|
58
56
|
And I should not see "second example in outer group"
|
|
59
57
|
And I should not see "first example in outer group"
|
|
60
58
|
|
|
61
59
|
Scenario: two examples - first example on declaration line
|
|
62
|
-
When I run "rspec example_spec.rb:3 --format doc"
|
|
60
|
+
When I run "rspec ./example_spec.rb:3 --format doc"
|
|
63
61
|
Then I should see "1 example, 0 failures"
|
|
64
62
|
And I should see "first example in outer group"
|
|
65
63
|
But I should not see "second example in outer group"
|
|
66
64
|
And I should not see "example in nested group"
|
|
67
65
|
|
|
68
66
|
Scenario: two examples - first example inside block
|
|
69
|
-
When I run "rspec example_spec.rb:4 --format doc"
|
|
67
|
+
When I run "rspec ./example_spec.rb:4 --format doc"
|
|
70
68
|
Then I should see "1 example, 0 failures"
|
|
71
69
|
And I should see "first example in outer group"
|
|
72
70
|
But I should not see "second example in outer group"
|
|
73
71
|
And I should not see "example in nested group"
|
|
74
72
|
|
|
75
73
|
Scenario: two examples - first example on end
|
|
76
|
-
When I run "rspec example_spec.rb:5 --format doc"
|
|
74
|
+
When I run "rspec ./example_spec.rb:5 --format doc"
|
|
77
75
|
Then I should see "1 example, 0 failures"
|
|
78
76
|
And I should see "first example in outer group"
|
|
79
77
|
But I should not see "second example in outer group"
|
|
80
78
|
And I should not see "example in nested group"
|
|
81
79
|
|
|
82
80
|
Scenario: two examples - first example after end but before next example
|
|
83
|
-
When I run "rspec example_spec.rb:6 --format doc"
|
|
81
|
+
When I run "rspec ./example_spec.rb:6 --format doc"
|
|
84
82
|
Then I should see "1 example, 0 failures"
|
|
85
83
|
And I should see "first example in outer group"
|
|
86
84
|
But I should not see "second example in outer group"
|
|
87
85
|
And I should not see "example in nested group"
|
|
88
86
|
|
|
89
87
|
Scenario: two examples - second example on declaration line
|
|
90
|
-
When I run "rspec example_spec.rb:7 --format doc"
|
|
88
|
+
When I run "rspec ./example_spec.rb:7 --format doc"
|
|
91
89
|
Then I should see "1 example, 0 failures"
|
|
92
90
|
And I should see "second example in outer group"
|
|
93
91
|
But I should not see "first example in outer group"
|
|
94
92
|
And I should not see "example in nested group"
|
|
95
93
|
|
|
96
94
|
Scenario: two examples - second example inside block
|
|
97
|
-
When I run "rspec example_spec.rb:7 --format doc"
|
|
95
|
+
When I run "rspec ./example_spec.rb:7 --format doc"
|
|
98
96
|
Then I should see "1 example, 0 failures"
|
|
99
97
|
And I should see "second example in outer group"
|
|
100
98
|
But I should not see "first example in outer group"
|
|
101
99
|
And I should not see "example in nested group"
|
|
102
100
|
|
|
103
101
|
Scenario: two examples - second example on end
|
|
104
|
-
When I run "rspec example_spec.rb:7 --format doc"
|
|
102
|
+
When I run "rspec ./example_spec.rb:7 --format doc"
|
|
105
103
|
Then I should see "1 example, 0 failures"
|
|
106
104
|
And I should see "second example in outer group"
|
|
107
105
|
But I should not see "first example in outer group"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Feature: line number option
|
|
2
2
|
|
|
3
|
-
As an
|
|
3
|
+
As an RSpec user
|
|
4
4
|
I want to run one example identified by the line number
|
|
5
5
|
|
|
6
6
|
Scenario: standard examples
|
|
@@ -20,7 +20,7 @@ Feature: line number option
|
|
|
20
20
|
|
|
21
21
|
end
|
|
22
22
|
"""
|
|
23
|
-
When I run "rspec example_spec.rb --line 5 --format doc"
|
|
23
|
+
When I run "rspec ./example_spec.rb --line 5 --format doc"
|
|
24
24
|
Then I should see "1 example, 0 failures"
|
|
25
25
|
Then I should see "should be > 8"
|
|
26
26
|
But the stdout should not contain "should be < 10"
|
|
@@ -38,7 +38,7 @@ Feature: line number option
|
|
|
38
38
|
|
|
39
39
|
end
|
|
40
40
|
"""
|
|
41
|
-
When I run "rspec example_spec.rb --line 5 --format doc"
|
|
41
|
+
When I run "rspec ./example_spec.rb --line 5 --format doc"
|
|
42
42
|
Then I should see "1 example, 0 failures"
|
|
43
43
|
Then I should see "should be > 8"
|
|
44
44
|
But the stdout should not contain "should be < 10"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Feature: custom options
|
|
2
|
+
|
|
3
|
+
In order to seamlessly provide my users more options
|
|
4
|
+
As an RSpec extenstion-library author
|
|
5
|
+
I want to define new options on the RSpec.configuration
|
|
6
|
+
|
|
7
|
+
Scenario: boolean option with default settings
|
|
8
|
+
Given a file named "boolean_option_spec.rb" with:
|
|
9
|
+
"""
|
|
10
|
+
RSpec.configure do |c|
|
|
11
|
+
c.add_option :custom_option, :type => :boolean
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "custom option" do
|
|
15
|
+
it "is false by default" do
|
|
16
|
+
RSpec.configuration.custom_option.should be_false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "is exposed as a predicate" do
|
|
20
|
+
RSpec.configuration.custom_option?.should be_false
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
"""
|
|
24
|
+
When I run "rspec ./boolean_option_spec.rb"
|
|
25
|
+
Then I should see "2 examples, 0 failures"
|
|
26
|
+
|
|
27
|
+
Scenario: boolean option set to default to true
|
|
28
|
+
Given a file named "boolean_option_spec.rb" with:
|
|
29
|
+
"""
|
|
30
|
+
RSpec.configure do |c|
|
|
31
|
+
c.add_option :custom_option, :type => :boolean, :default => true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "custom option" do
|
|
35
|
+
it "is true by default" do
|
|
36
|
+
RSpec.configuration.custom_option.should be_true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "is exposed as a predicate" do
|
|
40
|
+
RSpec.configuration.custom_option?.should be_true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
"""
|
|
44
|
+
When I run "rspec ./boolean_option_spec.rb"
|
|
45
|
+
Then I should see "2 examples, 0 failures"
|
|
46
|
+
|
|
47
|
+
@wip
|
|
48
|
+
Scenario: boolean option overridden in client app
|
|
49
|
+
Given a file named "boolean_option_spec.rb" with:
|
|
50
|
+
"""
|
|
51
|
+
RSpec.configure do |c|
|
|
52
|
+
c.add_option :custom_option, :type => :boolean
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
RSpec.configure do |c|
|
|
56
|
+
c.custom_option = true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "custom option" do
|
|
60
|
+
it "returns the value set in the client app" do
|
|
61
|
+
RSpec.configuration.custom_option.should be_true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "is exposed as a predicate" do
|
|
65
|
+
RSpec.configuration.custom_option?.should be_true
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
"""
|
|
69
|
+
When I run "rspec ./boolean_option_spec.rb"
|
|
70
|
+
Then I should see "2 examples, 0 failures"
|
|
71
|
+
|
|
@@ -5,22 +5,22 @@ Feature: spec/spec.opts
|
|
|
5
5
|
automatically.
|
|
6
6
|
|
|
7
7
|
Options declared in spec/spec.opts will override configuration
|
|
8
|
-
set up in
|
|
8
|
+
set up in RSpec.configure blocks.
|
|
9
9
|
|
|
10
|
-
Scenario: color set in
|
|
10
|
+
Scenario: color set in RSpec.configure
|
|
11
11
|
Given a file named "spec/example_spec.rb" with:
|
|
12
12
|
"""
|
|
13
|
-
|
|
13
|
+
RSpec.configure {|c| c.color_enabled = true }
|
|
14
14
|
|
|
15
15
|
describe "color_enabled" do
|
|
16
|
-
context "when set with
|
|
16
|
+
context "when set with RSpec.configure" do
|
|
17
17
|
it "is true" do
|
|
18
|
-
|
|
18
|
+
RSpec.configuration.color_enabled?.should be_true
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
"""
|
|
23
|
-
When I run "rspec spec/example_spec.rb"
|
|
23
|
+
When I run "rspec ./spec/example_spec.rb"
|
|
24
24
|
Then I should see "1 example, 0 failures"
|
|
25
25
|
|
|
26
26
|
Scenario: color set in .rspec
|
|
@@ -31,14 +31,14 @@ Feature: spec/spec.opts
|
|
|
31
31
|
And a file named "spec/example_spec.rb" with:
|
|
32
32
|
"""
|
|
33
33
|
describe "color_enabled" do
|
|
34
|
-
context "when set with
|
|
34
|
+
context "when set with RSpec.configure" do
|
|
35
35
|
it "is true" do
|
|
36
|
-
|
|
36
|
+
RSpec.configuration.color_enabled?.should be_true
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
"""
|
|
41
|
-
When I run "rspec spec/example_spec.rb"
|
|
41
|
+
When I run "rspec ./spec/example_spec.rb"
|
|
42
42
|
Then I should see "1 example, 0 failures"
|
|
43
43
|
|
|
44
44
|
@wip
|
|
@@ -49,20 +49,20 @@ Feature: spec/spec.opts
|
|
|
49
49
|
"""
|
|
50
50
|
And a file named "spec/spec_helper.rb" with:
|
|
51
51
|
"""
|
|
52
|
-
|
|
52
|
+
RSpec.configure {|c| c.formatter = 'progress'}
|
|
53
53
|
"""
|
|
54
54
|
And a file named "spec/example_spec.rb" with:
|
|
55
55
|
"""
|
|
56
56
|
require "spec_helper"
|
|
57
57
|
|
|
58
58
|
describe "formatter" do
|
|
59
|
-
context "when set with
|
|
59
|
+
context "when set with RSpec.configure and in spec.opts" do
|
|
60
60
|
it "takes the value set in spec.opts" do
|
|
61
|
-
|
|
61
|
+
RSpec.configuration.formatter.should be_an(RSpec::Core::Formatters::DocumentationFormatter)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
"""
|
|
66
|
-
When I run "rspec spec/example_spec.rb"
|
|
66
|
+
When I run "rspec ./spec/example_spec.rb"
|
|
67
67
|
Then I should see "1 example, 0 failures"
|
|
68
68
|
|