rspec 1.2.6 → 1.2.7
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/History.rdoc +22 -0
- data/Manifest.txt +9 -4
- data/Rakefile +13 -12
- data/Upgrade.rdoc +1 -1
- data/features/command_line/line_number_option.feature +56 -0
- data/features/command_line/line_number_option_with_example_with_no_name.feature +22 -0
- data/features/mocks/stub_implementation.feature +26 -0
- data/lib/autotest/rspec.rb +7 -7
- data/lib/spec/autorun.rb +1 -1
- data/lib/spec/deprecation.rb +3 -3
- data/lib/spec/dsl.rb +0 -1
- data/lib/spec/dsl/main.rb +6 -6
- data/lib/spec/example.rb +28 -29
- data/lib/spec/example/args_and_options.rb +1 -1
- data/lib/spec/example/before_and_after_hooks.rb +10 -10
- data/lib/spec/example/errors.rb +8 -3
- data/lib/spec/example/example_group.rb +0 -1
- data/lib/spec/example/example_group_factory.rb +3 -3
- data/lib/spec/example/example_group_hierarchy.rb +10 -10
- data/lib/spec/example/example_group_methods.rb +37 -29
- data/lib/spec/example/example_group_proxy.rb +9 -10
- data/lib/spec/example/example_matcher.rb +3 -3
- data/lib/spec/example/example_methods.rb +11 -11
- data/lib/spec/example/example_proxy.rb +5 -5
- data/lib/spec/example/module_reopening_fix.rb +7 -7
- data/lib/spec/example/pending.rb +1 -1
- data/lib/spec/example/predicate_matchers.rb +0 -1
- data/lib/spec/example/shared_example_group.rb +5 -5
- data/lib/spec/example/subject.rb +12 -16
- data/lib/spec/expectations/extensions/kernel.rb +1 -1
- data/lib/spec/expectations/fail_with.rb +4 -0
- data/lib/spec/matchers/generated_descriptions.rb +4 -16
- data/lib/spec/matchers/match.rb +5 -4
- data/lib/spec/matchers/matcher.rb +21 -3
- data/lib/spec/matchers/operator_matcher.rb +1 -1
- data/lib/spec/mocks/errors.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +3 -2
- data/lib/spec/mocks/methods.rb +8 -5
- data/lib/spec/mocks/proxy.rb +2 -2
- data/lib/spec/rake/spectask.rb +9 -3
- data/lib/spec/runner.rb +1 -1
- data/lib/spec/runner/{spec_parser.rb → line_number_query.rb} +20 -9
- data/lib/spec/runner/options.rb +10 -2
- data/lib/spec/version.rb +3 -2
- data/spec/autotest/failed_results_re_spec.rb +7 -0
- data/spec/spec/example/example_group_methods_spec.rb +61 -0
- data/spec/spec/example/example_matcher_spec.rb +7 -0
- data/spec/spec/example/example_methods_spec.rb +35 -7
- data/spec/spec/expectations/fail_with_spec.rb +18 -1
- data/spec/spec/matchers/match_spec.rb +20 -0
- data/spec/spec/matchers/matcher_spec.rb +27 -28
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_10263_spec.rb +4 -1
- data/spec/spec/mocks/bug_report_830_spec.rb +21 -0
- data/spec/spec/mocks/options_hash_spec.rb +1 -1
- data/spec/spec/mocks/stub_chain_spec.rb +7 -0
- data/spec/spec/mocks/stub_implementation_spec.rb +31 -0
- data/spec/spec/rake/spectask_spec.rb +150 -0
- data/spec/spec/runner/{spec_parser/spec_parser_fixture.rb → line_number_query/line_number_query_fixture.rb} +4 -4
- data/spec/spec/runner/{spec_parser_spec.rb → line_number_query_spec.rb} +31 -10
- data/spec/spec/runner/option_parser_spec.rb +1 -1
- data/spec/spec/runner/options_spec.rb +33 -25
- metadata +15 -10
- data/.autotest +0 -5
@@ -33,7 +33,7 @@ describe "should_not ==" do
|
|
33
33
|
|
34
34
|
it "should return true on success" do
|
35
35
|
subject = "apple"
|
36
|
-
(subject.should_not == "orange").should
|
36
|
+
(subject.should_not == "orange").should be_false
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should fail when target.==(actual) returns false" do
|
@@ -7,7 +7,10 @@ describe "Mock" do
|
|
7
7
|
@mock.should_receive(:msg) do |b|
|
8
8
|
b.should be_true #this call exposes the problem
|
9
9
|
end
|
10
|
-
|
10
|
+
begin
|
11
|
+
@mock.msg(false)
|
12
|
+
rescue Exception
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
specify "then the next example should behave as expected instead of saying" do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Mocks
|
5
|
+
describe 'Calling a method that catches StandardError' do
|
6
|
+
class Foo
|
7
|
+
def self.foo
|
8
|
+
bar
|
9
|
+
rescue StandardError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'still reports mock failures' do
|
14
|
+
Foo.should_not_receive :bar
|
15
|
+
lambda do
|
16
|
+
Foo.foo
|
17
|
+
end.should raise_error(MockExpectationError)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -22,6 +22,13 @@ module Spec
|
|
22
22
|
@subject.msg1.msg2.msg3.msg4.should equal(:return_value)
|
23
23
|
end
|
24
24
|
|
25
|
+
it "returns expected value from chaining four method calls twice with some shared" do
|
26
|
+
@subject.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:first)
|
27
|
+
@subject.stub_chain(:msg5, :msg2, :msg3, :msg4).and_return(:second)
|
28
|
+
|
29
|
+
@subject.msg1.msg2.msg3.msg4.should equal(:first)
|
30
|
+
@subject.msg5.msg2.msg3.msg4.should equal(:second)
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Mocks
|
5
|
+
describe "stub implementation" do
|
6
|
+
context "with no args" do
|
7
|
+
it "execs the block when called" do
|
8
|
+
obj = stub()
|
9
|
+
obj.stub(:foo) { :bar }
|
10
|
+
obj.foo.should == :bar
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with one arg" do
|
15
|
+
it "execs the block with that arg when called" do
|
16
|
+
obj = stub()
|
17
|
+
obj.stub(:foo) {|given| given}
|
18
|
+
obj.foo(:bar).should == :bar
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with variable args" do
|
23
|
+
it "execs the block when called" do
|
24
|
+
obj = stub()
|
25
|
+
obj.stub(:foo) {|*given| given.first}
|
26
|
+
obj.foo(:bar).should == :bar
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../../../lib/spec/rake/spectask.rb'
|
3
|
+
|
4
|
+
module Spec
|
5
|
+
module Rake
|
6
|
+
|
7
|
+
class MockTask
|
8
|
+
class << self
|
9
|
+
attr_accessor :last_instance, :last_cmd
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.tasks
|
13
|
+
@tasks ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.reset_tasks
|
17
|
+
@tasks = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.task(name)
|
21
|
+
tasks[name]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.register_task(name, block)
|
25
|
+
tasks[name] = block
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(name, &block)
|
29
|
+
MockTask.register_task(name, block)
|
30
|
+
MockTask.last_instance = block
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.create_task(name, &block)
|
34
|
+
new(name, &block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class SpecTask
|
39
|
+
def task(name, &block)
|
40
|
+
MockTask.create_task(name, &block)
|
41
|
+
end
|
42
|
+
|
43
|
+
def system(cmd)
|
44
|
+
MockTask.last_cmd = cmd
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
def default_ruby_path
|
49
|
+
RUBY
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe SpecTask do
|
54
|
+
|
55
|
+
before(:each) do
|
56
|
+
MockTask.reset_tasks
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should execute rake's ruby path by default" do
|
60
|
+
task = SpecTask.new
|
61
|
+
MockTask.last_instance.call
|
62
|
+
MockTask.last_cmd.should match(/^#{task.default_ruby_path} /)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should execute the command with system if ruby_cmd is specified" do
|
66
|
+
task = SpecTask.new {|t| t.ruby_cmd = "path_to_multiruby"}
|
67
|
+
task.should_receive(:system).and_return(true)
|
68
|
+
MockTask.last_instance.call
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should execute the ruby_cmd path if specified" do
|
72
|
+
SpecTask.new {|t| t.ruby_cmd = "path_to_multiruby"}
|
73
|
+
MockTask.last_instance.call
|
74
|
+
MockTask.last_cmd.should match(/^path_to_multiruby /)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should produce a deprecation warning if the out option is used" do
|
78
|
+
SpecTask.new {|t| t.out = "somewhere_over_the_rainbow"}
|
79
|
+
STDERR.should_receive(:puts).with("The Spec::Rake::SpecTask#out attribute is DEPRECATED and will be removed in a future version. Use --format FORMAT:WHERE instead.")
|
80
|
+
MockTask.last_instance.call
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should produce an error if failure_message is set and the command fails" do
|
84
|
+
task = SpecTask.new {|t| t.failure_message = "oops"; t.fail_on_error = false}
|
85
|
+
STDERR.should_receive(:puts).with("oops")
|
86
|
+
task.stub(:system).and_return(false)
|
87
|
+
MockTask.last_instance.call
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should raise if fail_on_error is set and the command fails" do
|
91
|
+
task = SpecTask.new
|
92
|
+
task.stub(:system).and_return(false)
|
93
|
+
lambda {MockTask.last_instance.call}.should raise_error
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should not raise if fail_on_error is not set and the command fails" do
|
97
|
+
task = SpecTask.new {|t| t.fail_on_error = false}
|
98
|
+
task.stub(:system).and_return(false)
|
99
|
+
lambda {MockTask.last_instance.call}.should_not raise_error
|
100
|
+
end
|
101
|
+
|
102
|
+
context "with ENV['SPEC'] set" do
|
103
|
+
before(:each) do
|
104
|
+
@orig_env_spec = ENV['SPEC']
|
105
|
+
ENV['SPEC'] = 'foo.rb'
|
106
|
+
end
|
107
|
+
after(:each) do
|
108
|
+
ENV['SPEC'] = @orig_env_spec
|
109
|
+
end
|
110
|
+
it "should use the provided file list" do
|
111
|
+
task = SpecTask.new
|
112
|
+
task.spec_file_list.should == ["foo.rb"]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "with the rcov option" do
|
117
|
+
|
118
|
+
it "should create a clobber_rcov task" do
|
119
|
+
MockTask.stub!(:create_task)
|
120
|
+
MockTask.should_receive(:create_task).with(:clobber_rcov)
|
121
|
+
SpecTask.new(:rcov) {|t| t.rcov = true}
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should setup the clobber_rcov task to remove the rcov directory" do
|
125
|
+
task = SpecTask.new(:rcov) {|t| t.rcov = true; t.rcov_dir = "path_to_rcov_directory"}
|
126
|
+
task.should_receive(:rm_r).with("path_to_rcov_directory")
|
127
|
+
MockTask.task(:clobber_rcov).call
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should make the clobber task depend on clobber_rcov" do
|
131
|
+
MockTask.stub!(:create_task)
|
132
|
+
MockTask.should_receive(:create_task).with(:clobber => [:clobber_rcov])
|
133
|
+
SpecTask.new(:rcov) {|t| t.rcov = true}
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should make the rcov task depend on clobber_rcov" do
|
137
|
+
MockTask.stub!(:create_task)
|
138
|
+
MockTask.should_receive(:create_task).with(:rcov => :clobber_rcov)
|
139
|
+
SpecTask.new(:rcov) {|t| t.rcov = true}
|
140
|
+
end
|
141
|
+
|
142
|
+
it "creates an rcov options list" do
|
143
|
+
MockTask.stub!(:create_task)
|
144
|
+
task = SpecTask.new(:rcov) {|t| t.rcov = true, t.rcov_opts = ['a','b']}
|
145
|
+
task.rcov_option_list.should == "a b"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -20,24 +20,24 @@ describe "d" do
|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
|
-
class
|
23
|
+
class LineNumberQuerySubject
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
26
|
+
describe LineNumberQuerySubject do
|
27
27
|
|
28
28
|
it "5" do
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
-
describe
|
33
|
+
describe LineNumberQuerySubject, "described" do
|
34
34
|
|
35
35
|
it "6" do
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
40
|
+
describe LineNumberQuerySubject, "described", :something => :something_else do
|
41
41
|
|
42
42
|
it "7" do
|
43
43
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "LineNumberQuery" do
|
4
4
|
with_sandboxed_options do
|
5
5
|
attr_reader :parser, :file
|
6
6
|
|
7
7
|
before do
|
8
|
-
@parser = Spec::Runner::
|
9
|
-
@file = "#{File.dirname(__FILE__)}/
|
8
|
+
@parser = Spec::Runner::LineNumberQuery.new(options)
|
9
|
+
@file = "#{File.dirname(__FILE__)}/line_number_query/line_number_query_fixture.rb"
|
10
10
|
load file
|
11
11
|
end
|
12
12
|
|
@@ -43,27 +43,27 @@ describe "SpecParser" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should find context name for type" do
|
46
|
-
parser.spec_name_for(file, 26).should == "
|
46
|
+
parser.spec_name_for(file, 26).should == "LineNumberQuerySubject"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should find context and spec name for type" do
|
50
|
-
parser.spec_name_for(file, 28).should == "
|
50
|
+
parser.spec_name_for(file, 28).should == "LineNumberQuerySubject 5"
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should find context and description for type" do
|
54
|
-
parser.spec_name_for(file, 33).should == "
|
54
|
+
parser.spec_name_for(file, 33).should == "LineNumberQuerySubject described"
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should find context and description and example for type" do
|
58
|
-
parser.spec_name_for(file, 36).should == "
|
58
|
+
parser.spec_name_for(file, 36).should == "LineNumberQuerySubject described 6"
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should find context and description for type with modifications" do
|
62
|
-
parser.spec_name_for(file, 40).should == "
|
62
|
+
parser.spec_name_for(file, 40).should == "LineNumberQuerySubject described"
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should find context and described and example for type with modifications" do
|
66
|
-
parser.spec_name_for(file, 43).should == "
|
66
|
+
parser.spec_name_for(file, 43).should == "LineNumberQuerySubject described 7"
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should find example group" do
|
@@ -91,9 +91,30 @@ describe "SpecParser" do
|
|
91
91
|
options = stub('options', :example_groups => [
|
92
92
|
stub('example_group', :location => nil)
|
93
93
|
])
|
94
|
-
parser = Spec::Runner::
|
94
|
+
parser = Spec::Runner::LineNumberQuery.new(options)
|
95
95
|
parser.spec_name_for('foo',37).should == nil
|
96
96
|
end
|
97
97
|
|
98
|
+
describe "#example_line_for" do
|
99
|
+
it "should find example declared on same line" do
|
100
|
+
parser.example_line_for(file, 5).should == 5
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should find example declared on the line above, while still inside the example" do
|
104
|
+
parser.example_line_for(file, 6).should == 5
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should find example declared from empty line below the example" do
|
108
|
+
parser.example_line_for(file, 7).should == 5
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should find the group declared on the same line" do
|
112
|
+
parser.example_line_for(file, 3).should == 3
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should find the group declared above the first example" do
|
116
|
+
parser.example_line_for(file, 4).should == 3
|
117
|
+
end
|
118
|
+
end
|
98
119
|
end
|
99
120
|
end
|
@@ -267,7 +267,7 @@ describe "OptionParser" do
|
|
267
267
|
attr_reader :file, :dir
|
268
268
|
before(:each) do
|
269
269
|
@original_rspec_options = Spec::Runner.options
|
270
|
-
@file = "#{File.dirname(__FILE__)}/
|
270
|
+
@file = "#{File.dirname(__FILE__)}/line_number_query/line_number_query_fixture.rb"
|
271
271
|
@dir = File.dirname(file)
|
272
272
|
end
|
273
273
|
|
@@ -19,26 +19,34 @@ module Spec
|
|
19
19
|
Spec::Expectations.differ = nil
|
20
20
|
end
|
21
21
|
|
22
|
+
describe "#require_ruby_debug" do
|
23
|
+
it "should require ruby-debug" do
|
24
|
+
@options.stub!(:require)
|
25
|
+
@options.should_receive(:require).with("ruby-debug")
|
26
|
+
@options.require_ruby_debug
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
22
30
|
describe "#examples" do
|
23
31
|
it "should default to empty array" do
|
24
32
|
@options.examples.should == []
|
25
33
|
end
|
26
34
|
end
|
27
|
-
|
35
|
+
|
28
36
|
describe "#include_pattern" do
|
29
37
|
it "should default to '**/*_spec.rb'" do
|
30
38
|
@options.filename_pattern.should == "**/*_spec.rb"
|
31
39
|
end
|
32
40
|
end
|
33
|
-
|
41
|
+
|
34
42
|
describe "#files_to_load" do
|
35
|
-
|
43
|
+
|
36
44
|
it "should load files not following pattern if named explicitly" do
|
37
45
|
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_bar.rb")
|
38
46
|
@options.files << file
|
39
47
|
@options.files_to_load.should include(file)
|
40
48
|
end
|
41
|
-
|
49
|
+
|
42
50
|
describe "with default --pattern" do
|
43
51
|
it "should load files named _spec.rb" do
|
44
52
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources/")
|
@@ -46,33 +54,33 @@ module Spec
|
|
46
54
|
@options.files_to_load.should == ["#{dir}/a_spec.rb"]
|
47
55
|
end
|
48
56
|
end
|
49
|
-
|
57
|
+
|
50
58
|
describe "with explicit pattern (single)" do
|
51
59
|
before(:each) do
|
52
60
|
@options.filename_pattern = "**/*_foo.rb"
|
53
61
|
end
|
54
|
-
|
62
|
+
|
55
63
|
it "should load files following pattern" do
|
56
64
|
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
57
65
|
@options.files << file
|
58
66
|
@options.files_to_load.should include(file)
|
59
67
|
end
|
60
|
-
|
68
|
+
|
61
69
|
it "should load files in directories following pattern" do
|
62
70
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
63
71
|
@options.files << dir
|
64
72
|
@options.files_to_load.should include("#{dir}/a_foo.rb")
|
65
73
|
end
|
66
|
-
|
74
|
+
|
67
75
|
it "should not load files in directories not following pattern" do
|
68
76
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
69
77
|
@options.files << dir
|
70
78
|
@options.files_to_load.should_not include("#{dir}/a_bar.rb")
|
71
79
|
end
|
72
80
|
end
|
73
|
-
|
81
|
+
|
74
82
|
describe "with explicit pattern (comma,separated,values)" do
|
75
|
-
|
83
|
+
|
76
84
|
before(:each) do
|
77
85
|
@options.filename_pattern = "**/*_foo.rb,**/*_bar.rb"
|
78
86
|
end
|
@@ -83,16 +91,16 @@ module Spec
|
|
83
91
|
@options.files_to_load.should include("#{dir}/a_foo.rb")
|
84
92
|
@options.files_to_load.should include("#{dir}/a_bar.rb")
|
85
93
|
end
|
86
|
-
|
94
|
+
|
87
95
|
it "should support comma separated values with spaces" do
|
88
96
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
89
97
|
@options.files << dir
|
90
98
|
@options.files_to_load.should include("#{dir}/a_foo.rb")
|
91
99
|
@options.files_to_load.should include("#{dir}/a_bar.rb")
|
92
100
|
end
|
93
|
-
|
101
|
+
|
94
102
|
end
|
95
|
-
|
103
|
+
|
96
104
|
end
|
97
105
|
|
98
106
|
describe "#backtrace_tweaker" do
|
@@ -106,7 +114,7 @@ module Spec
|
|
106
114
|
@options.dry_run.should == false
|
107
115
|
end
|
108
116
|
end
|
109
|
-
|
117
|
+
|
110
118
|
describe "#debug" do
|
111
119
|
it "should default to false" do
|
112
120
|
@options.debug.should == false
|
@@ -228,7 +236,7 @@ module Spec
|
|
228
236
|
@options.run_examples.should be_true
|
229
237
|
end
|
230
238
|
end
|
231
|
-
|
239
|
+
|
232
240
|
describe "debug option not specified" do
|
233
241
|
it "should not cause ruby_debug to be required" do
|
234
242
|
@options.debug = false
|
@@ -236,7 +244,7 @@ module Spec
|
|
236
244
|
@options.run_examples.should be_true
|
237
245
|
end
|
238
246
|
end
|
239
|
-
|
247
|
+
|
240
248
|
describe "#load_class" do
|
241
249
|
it "should raise error when not class name" do
|
242
250
|
lambda do
|
@@ -251,7 +259,7 @@ module Spec
|
|
251
259
|
@options.reporter.options.should === @options
|
252
260
|
end
|
253
261
|
end
|
254
|
-
|
262
|
+
|
255
263
|
describe "#number_of_examples" do
|
256
264
|
context "when --example is parsed" do
|
257
265
|
it "provides the number of examples parsed instead of the total number of examples collected" do
|
@@ -339,16 +347,16 @@ module Spec
|
|
339
347
|
Spec::Runner.configuration.stub!(:predicate_matchers).and_return({:this => :that?})
|
340
348
|
group = Class.new(::Spec::Example::ExampleGroupDouble).describe("Some Examples")
|
341
349
|
example = group.new(::Spec::Example::ExampleProxy.new)
|
342
|
-
|
350
|
+
|
343
351
|
@options.run_examples
|
344
352
|
example.this
|
345
353
|
end
|
346
|
-
|
354
|
+
|
347
355
|
after(:each) do
|
348
356
|
Spec::Example::ExampleMethods.class_eval "undef :this"
|
349
357
|
end
|
350
358
|
end
|
351
|
-
|
359
|
+
|
352
360
|
describe "with a mock framework defined as a Symbol" do
|
353
361
|
it "includes Spec::Adapters::MockFramework" do
|
354
362
|
Spec::Runner.configuration.stub!(:mock_framework).and_return('spec/adapters/mock_frameworks/rspec')
|
@@ -358,7 +366,7 @@ module Spec
|
|
358
366
|
@options.run_examples
|
359
367
|
end
|
360
368
|
end
|
361
|
-
|
369
|
+
|
362
370
|
describe "with a mock framework defined as a Module" do
|
363
371
|
it "includes the module in ExampleMethods" do
|
364
372
|
mod = Module.new
|
@@ -367,7 +375,7 @@ module Spec
|
|
367
375
|
@options.run_examples
|
368
376
|
end
|
369
377
|
end
|
370
|
-
|
378
|
+
|
371
379
|
describe "when not given a custom runner" do
|
372
380
|
it "should use the standard" do
|
373
381
|
runner = ::Spec::Runner::ExampleGroupRunner.new(@options)
|
@@ -430,7 +438,7 @@ module Spec
|
|
430
438
|
@options.after_suite_parts << lambda do |success|
|
431
439
|
success_result = success
|
432
440
|
end
|
433
|
-
|
441
|
+
|
434
442
|
@options.run_examples
|
435
443
|
success_result.should be_true
|
436
444
|
end
|
@@ -457,12 +465,12 @@ module Spec
|
|
457
465
|
@heckle_runner_mock = mock("HeckleRunner")
|
458
466
|
@options.heckle_runner = @heckle_runner_mock
|
459
467
|
end
|
460
|
-
|
468
|
+
|
461
469
|
it "should heckle" do
|
462
470
|
@heckle_runner_mock.should_receive(:heckle_with)
|
463
471
|
@options.run_examples
|
464
472
|
end
|
465
|
-
|
473
|
+
|
466
474
|
it "shouldn't heckle recursively" do
|
467
475
|
heckled = false
|
468
476
|
@heckle_runner_mock.should_receive(:heckle_with) {
|