rspec-core 2.0.0.beta.22 → 2.0.0.rc

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.
Files changed (67) hide show
  1. data/Gemfile +2 -2
  2. data/{History.md → History.markdown} +24 -2
  3. data/Rakefile +1 -0
  4. data/Upgrade.markdown +36 -3
  5. data/bin/rspec +1 -2
  6. data/features/command_line/configure.feature +4 -4
  7. data/features/command_line/example_name_option.feature +17 -3
  8. data/features/command_line/exit_status.feature +13 -28
  9. data/features/command_line/line_number_appended_to_path.feature +12 -16
  10. data/features/command_line/line_number_option.feature +4 -5
  11. data/features/command_line/rake_task.feature +68 -0
  12. data/features/configuration/custom_settings.feature +2 -4
  13. data/features/configuration/fail_fast.feature +77 -0
  14. data/features/configuration/read_options_from_file.feature +2 -5
  15. data/features/example_groups/basic_structure.feature +54 -0
  16. data/features/example_groups/shared_example_group.feature +38 -27
  17. data/features/filtering/exclusion_filters.feature +40 -4
  18. data/features/filtering/inclusion_filters.feature +36 -27
  19. data/features/filtering/run_all_when_everything_filtered.feature +46 -0
  20. data/features/hooks/before_and_after_hooks.feature +21 -1
  21. data/features/pending/pending_examples.feature +24 -5
  22. data/lib/rspec/autorun.rb +2 -0
  23. data/lib/rspec/core.rb +6 -4
  24. data/lib/rspec/core/configuration.rb +69 -23
  25. data/lib/rspec/core/configuration_options.rb +1 -0
  26. data/lib/rspec/core/example.rb +0 -1
  27. data/lib/rspec/core/example_group.rb +23 -8
  28. data/lib/rspec/core/formatters/base_formatter.rb +14 -4
  29. data/lib/rspec/core/formatters/base_text_formatter.rb +2 -0
  30. data/lib/rspec/core/formatters/documentation_formatter.rb +2 -0
  31. data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
  32. data/lib/rspec/core/metadata.rb +18 -11
  33. data/lib/rspec/core/option_parser.rb +6 -1
  34. data/lib/rspec/core/rake_task.rb +10 -10
  35. data/lib/rspec/core/runner.rb +20 -1
  36. data/lib/rspec/core/subject.rb +26 -3
  37. data/lib/rspec/core/version.rb +1 -1
  38. data/lib/rspec/core/world.rb +2 -1
  39. data/spec/autotest/failed_results_re_spec.rb +1 -1
  40. data/spec/rspec/core/configuration_spec.rb +13 -0
  41. data/spec/rspec/core/example_group_spec.rb +107 -26
  42. data/spec/rspec/core/example_spec.rb +11 -24
  43. data/spec/rspec/core/formatters/base_formatter_spec.rb +17 -1
  44. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +6 -5
  45. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +3 -2
  46. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +25 -22
  47. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +23 -20
  48. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +25 -22
  49. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +25 -2
  50. data/spec/rspec/core/formatters/html_formatter_spec.rb +10 -2
  51. data/spec/rspec/core/formatters/progress_formatter_spec.rb +1 -0
  52. data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +1 -0
  53. data/spec/rspec/core/hooks_filtering_spec.rb +5 -5
  54. data/spec/rspec/core/hooks_spec.rb +4 -4
  55. data/spec/rspec/core/metadata_spec.rb +20 -0
  56. data/spec/rspec/core/option_parser_spec.rb +16 -0
  57. data/spec/rspec/core/rake_task_spec.rb +0 -1
  58. data/spec/rspec/core/reporter_spec.rb +1 -1
  59. data/spec/rspec/core/runner_spec.rb +18 -0
  60. data/spec/rspec/core/shared_example_group_spec.rb +2 -2
  61. data/spec/spec_helper.rb +14 -3
  62. metadata +54 -45
  63. data/.rspec +0 -1
  64. data/features/example_groups/describe_aliases.feature +0 -25
  65. data/features/example_groups/nested_groups.feature +0 -44
  66. data/lib/rspec/core/around_proxy.rb +0 -14
  67. data/lib/rspec/core/formatters.rb +0 -8
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'rspec/core/formatters/text_mate_formatter'
2
3
  require 'nokogiri'
3
4
 
4
5
  module RSpec
@@ -14,7 +14,7 @@ module RSpec::Core
14
14
  end
15
15
  group = ExampleGroup.describe
16
16
  group.example("example") {}
17
- group.run_all
17
+ group.run
18
18
  filters.should == [
19
19
  "before all in config",
20
20
  "around each in config",
@@ -37,7 +37,7 @@ module RSpec::Core
37
37
  end
38
38
  group = ExampleGroup.describe(:match => true)
39
39
  group.example("example") {}
40
- group.run_all
40
+ group.run
41
41
  filters.should == [
42
42
  "before all in config",
43
43
  "around each in config",
@@ -58,7 +58,7 @@ module RSpec::Core
58
58
  end
59
59
  group = ExampleGroup.describe(:match => true)
60
60
  group.example("example") {}
61
- group.run_all
61
+ group.run
62
62
  filters.should == []
63
63
  end
64
64
  end
@@ -75,7 +75,7 @@ module RSpec::Core
75
75
  end
76
76
  group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
77
77
  group.example("example") {}
78
- group.run_all
78
+ group.run
79
79
  filters.should == [
80
80
  "before all in config",
81
81
  "around each in config",
@@ -96,7 +96,7 @@ module RSpec::Core
96
96
  end
97
97
  group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
98
98
  group.example("example") {}
99
- group.run_all
99
+ group.run
100
100
  filters.should == []
101
101
  end
102
102
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  module RSpec::Core
4
4
  describe Hooks do
5
5
  describe "#around" do
6
- context "when not running the example within the arond block" do
6
+ context "when not running the example within the around block" do
7
7
  it "does not run the example" do
8
8
  examples = []
9
9
  group = ExampleGroup.describe do
@@ -13,7 +13,7 @@ module RSpec::Core
13
13
  examples << self
14
14
  end
15
15
  end
16
- group.run_all
16
+ group.run
17
17
  examples.should have(0).example
18
18
  end
19
19
  end
@@ -29,7 +29,7 @@ module RSpec::Core
29
29
  examples << self
30
30
  end
31
31
  end
32
- group.run_all
32
+ group.run
33
33
  examples.should have(1).example
34
34
  end
35
35
  end
@@ -48,7 +48,7 @@ module RSpec::Core
48
48
  examples << self
49
49
  end
50
50
  end
51
- group.run_all
51
+ group.run
52
52
  examples.should have(1).example
53
53
  end
54
54
  end
@@ -65,6 +65,26 @@ module RSpec
65
65
  m = m.for_example("example", {})
66
66
  m[:full_description].should == "group example"
67
67
  end
68
+
69
+ %w[# . ::].each do |char|
70
+ context "with a 2nd arg starting with #{char}" do
71
+ it "removes the space" do
72
+ m = Metadata.new
73
+ m.process(Array, "#{char}method")
74
+ m[:example_group][:full_description].should eq("Array#{char}method")
75
+ end
76
+ end
77
+
78
+ context "with a nested description starting with #" do
79
+ it "removes the space" do
80
+ m = Metadata.new
81
+ m.process("Object")
82
+ m = Metadata.new(m)
83
+ m.process("#{char}method")
84
+ m[:example_group][:full_description].should eq("Object#{char}method")
85
+ end
86
+ end
87
+ end
68
88
  end
69
89
 
70
90
  describe "description" do
@@ -15,5 +15,21 @@ module RSpec::Core
15
15
  options = Parser.parse!(%w[--formatter doc])
16
16
  options.should eq( {:formatter=>"doc"} )
17
17
  end
18
+
19
+ it "does not parse empty args" do
20
+ parser = Parser.new
21
+ OptionParser.should_not_receive(:new)
22
+ parser.parse!([])
23
+ end
24
+
25
+ it "parses output stream from --out" do
26
+ options = Parser.parse!(%w[--out foo.txt])
27
+ options.should eq( {:output_stream=>"foo.txt"} )
28
+ end
29
+
30
+ it "parses output stream from -o" do
31
+ options = Parser.parse!(%w[-o foo.txt])
32
+ options.should eq( {:output_stream=>"foo.txt"} )
33
+ end
18
34
  end
19
35
  end
@@ -121,7 +121,6 @@ module RSpec::Core
121
121
  task.spec_opts = "-Ifoo"
122
122
  spec_command.should =~ /rspec -Ifoo/
123
123
  end
124
-
125
124
  end
126
125
 
127
126
  end
@@ -38,7 +38,7 @@ module RSpec::Core
38
38
  group.describe("context 1")
39
39
  group.describe("context 2")
40
40
 
41
- group.run_all(Reporter.new(formatter))
41
+ group.run(Reporter.new(formatter))
42
42
 
43
43
  order.should == [
44
44
  "Started: root",
@@ -2,6 +2,24 @@ require 'spec_helper'
2
2
 
3
3
  module RSpec::Core
4
4
  describe Runner do
5
+ describe 'at_exit' do
6
+ it 'sets an at_exit hook if none is already set' do
7
+ RSpec::Core::Runner.stub(:installed_at_exit?).and_return(false)
8
+ RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
9
+ RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
10
+ RSpec::Core::Runner.should_receive(:at_exit)
11
+ RSpec::Core::Runner.autorun
12
+ end
13
+
14
+ it 'does not set the at_exit hook if it is already set' do
15
+ RSpec::Core::Runner.stub(:installed_at_exit?).and_return(true)
16
+ RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
17
+ RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
18
+ RSpec::Core::Runner.should_receive(:at_exit).never
19
+ RSpec::Core::Runner.autorun
20
+ end
21
+ end
22
+
5
23
  describe "#run" do
6
24
  context "with --drb or -X" do
7
25
  before(:each) do
@@ -97,7 +97,7 @@ module RSpec::Core
97
97
  group = ExampleGroup.describe("group") do
98
98
  it_should_behave_like "thing", :value1, :value2
99
99
  end
100
- group.run_all
100
+ group.run
101
101
 
102
102
  passed_params.should == { :param1 => :value1, :param2 => :value2 }
103
103
  end
@@ -135,7 +135,7 @@ module RSpec::Core
135
135
  end
136
136
  end
137
137
  end
138
- group.run_all
138
+ group.run
139
139
 
140
140
  scopes[0].should be(scopes[1])
141
141
  end
@@ -23,9 +23,15 @@ class NullObject
23
23
  end
24
24
  end
25
25
 
26
- class RSpec::Core::ExampleGroup
27
- def self.run_all(reporter=nil)
28
- run(reporter || NullObject.new)
26
+ module RSpec::Core
27
+ class SandboxedExampleGroup < ExampleGroup
28
+ def self.run(reporter=nil)
29
+ @orig_mock_space = RSpec::Mocks::space
30
+ RSpec::Mocks::space = RSpec::Mocks::Space.new
31
+ super(reporter || NullObject.new)
32
+ ensure
33
+ RSpec::Mocks::space = @orig_mock_space
34
+ end
29
35
  end
30
36
  end
31
37
 
@@ -42,8 +48,13 @@ def sandboxed(&block)
42
48
  object.extend(RSpec::Core::ObjectExtensions)
43
49
  object.extend(RSpec::Core::SharedExampleGroup)
44
50
 
51
+ @orig_example_group_class = RSpec::Core::const_get(:ExampleGroup)
52
+ RSpec::Core::__send__ :remove_const, :ExampleGroup
53
+ RSpec::Core::const_set(:ExampleGroup, RSpec::Core::SandboxedExampleGroup)
45
54
  object.instance_eval(&block)
46
55
  ensure
56
+ RSpec::Core::__send__ :remove_const, :ExampleGroup
57
+ RSpec::Core::const_set(:ExampleGroup, @orig_example_group_class)
47
58
  RSpec.instance_variable_set(:@configuration, @orig_config)
48
59
  RSpec.instance_variable_set(:@world, @orig_world)
49
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7712058
4
5
  prerelease: true
5
6
  segments:
6
7
  - 2
7
8
  - 0
8
9
  - 0
9
- - beta
10
- - 22
11
- version: 2.0.0.beta.22
10
+ - rc
11
+ version: 2.0.0.rc
12
12
  platform: ruby
13
13
  authors:
14
14
  - Chad Humphries
@@ -17,127 +17,133 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-09-12 00:00:00 -05:00
20
+ date: 2010-10-04 00:00:00 -05:00
21
21
  default_executable: rspec
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
- name: rspec-expectations
25
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
29
+ hash: 7712058
30
30
  segments:
31
31
  - 2
32
32
  - 0
33
33
  - 0
34
- - beta
35
- - 22
36
- version: 2.0.0.beta.22
34
+ - rc
35
+ version: 2.0.0.rc
36
+ requirement: *id001
37
37
  type: :development
38
+ name: rspec-expectations
38
39
  prerelease: false
39
- version_requirements: *id001
40
40
  - !ruby/object:Gem::Dependency
41
- name: rspec-mocks
42
- requirement: &id002 !ruby/object:Gem::Requirement
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
43
42
  none: false
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
46
+ hash: 7712058
47
47
  segments:
48
48
  - 2
49
49
  - 0
50
50
  - 0
51
- - beta
52
- - 22
53
- version: 2.0.0.beta.22
51
+ - rc
52
+ version: 2.0.0.rc
53
+ requirement: *id002
54
54
  type: :development
55
+ name: rspec-mocks
55
56
  prerelease: false
56
- version_requirements: *id002
57
57
  - !ruby/object:Gem::Dependency
58
- name: cucumber
59
- requirement: &id003 !ruby/object:Gem::Requirement
58
+ version_requirements: &id003 !ruby/object:Gem::Requirement
60
59
  none: false
61
60
  requirements:
62
61
  - - ">="
63
62
  - !ruby/object:Gem::Version
63
+ hash: 13
64
64
  segments:
65
65
  - 0
66
66
  - 5
67
67
  - 3
68
68
  version: 0.5.3
69
+ requirement: *id003
69
70
  type: :development
71
+ name: cucumber
70
72
  prerelease: false
71
- version_requirements: *id003
72
73
  - !ruby/object:Gem::Dependency
73
- name: autotest
74
- requirement: &id004 !ruby/object:Gem::Requirement
74
+ version_requirements: &id004 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
+ hash: 37
79
80
  segments:
80
81
  - 4
81
82
  - 2
82
83
  - 9
83
84
  version: 4.2.9
85
+ requirement: *id004
84
86
  type: :development
87
+ name: autotest
85
88
  prerelease: false
86
- version_requirements: *id004
87
89
  - !ruby/object:Gem::Dependency
88
- name: syntax
89
- requirement: &id005 !ruby/object:Gem::Requirement
90
+ version_requirements: &id005 !ruby/object:Gem::Requirement
90
91
  none: false
91
92
  requirements:
92
93
  - - ">="
93
94
  - !ruby/object:Gem::Version
95
+ hash: 23
94
96
  segments:
95
97
  - 1
96
98
  - 0
97
99
  - 0
98
100
  version: 1.0.0
101
+ requirement: *id005
99
102
  type: :development
103
+ name: syntax
100
104
  prerelease: false
101
- version_requirements: *id005
102
105
  - !ruby/object:Gem::Dependency
103
- name: flexmock
104
- requirement: &id006 !ruby/object:Gem::Requirement
106
+ version_requirements: &id006 !ruby/object:Gem::Requirement
105
107
  none: false
106
108
  requirements:
107
109
  - - ">="
108
110
  - !ruby/object:Gem::Version
111
+ hash: 3
109
112
  segments:
110
113
  - 0
111
114
  version: "0"
115
+ requirement: *id006
112
116
  type: :development
117
+ name: flexmock
113
118
  prerelease: false
114
- version_requirements: *id006
115
119
  - !ruby/object:Gem::Dependency
116
- name: mocha
117
- requirement: &id007 !ruby/object:Gem::Requirement
120
+ version_requirements: &id007 !ruby/object:Gem::Requirement
118
121
  none: false
119
122
  requirements:
120
123
  - - ">="
121
124
  - !ruby/object:Gem::Version
125
+ hash: 3
122
126
  segments:
123
127
  - 0
124
128
  version: "0"
129
+ requirement: *id007
125
130
  type: :development
131
+ name: mocha
126
132
  prerelease: false
127
- version_requirements: *id007
128
133
  - !ruby/object:Gem::Dependency
129
- name: rr
130
- requirement: &id008 !ruby/object:Gem::Requirement
134
+ version_requirements: &id008 !ruby/object:Gem::Requirement
131
135
  none: false
132
136
  requirements:
133
137
  - - ">="
134
138
  - !ruby/object:Gem::Version
139
+ hash: 3
135
140
  segments:
136
141
  - 0
137
142
  version: "0"
143
+ requirement: *id008
138
144
  type: :development
145
+ name: rr
139
146
  prerelease: false
140
- version_requirements: *id008
141
147
  description: RSpec runner and example groups
142
148
  email: dchelimsky@gmail.com;chad.humphries@gmail.com
143
149
  executables:
@@ -149,10 +155,9 @@ extra_rdoc_files:
149
155
  files:
150
156
  - .document
151
157
  - .gitignore
152
- - .rspec
153
158
  - .treasure_map.rb
154
159
  - Gemfile
155
- - History.md
160
+ - History.markdown
156
161
  - License.txt
157
162
  - README.markdown
158
163
  - Rakefile
@@ -166,13 +171,15 @@ files:
166
171
  - features/command_line/exit_status.feature
167
172
  - features/command_line/line_number_appended_to_path.feature
168
173
  - features/command_line/line_number_option.feature
174
+ - features/command_line/rake_task.feature
169
175
  - features/configuration/custom_settings.feature
176
+ - features/configuration/fail_fast.feature
170
177
  - features/configuration/read_options_from_file.feature
171
- - features/example_groups/describe_aliases.feature
172
- - features/example_groups/nested_groups.feature
178
+ - features/example_groups/basic_structure.feature
173
179
  - features/example_groups/shared_example_group.feature
174
180
  - features/filtering/exclusion_filters.feature
175
181
  - features/filtering/inclusion_filters.feature
182
+ - features/filtering/run_all_when_everything_filtered.feature
176
183
  - features/formatters/custom_formatter.feature
177
184
  - features/hooks/around_hooks.feature
178
185
  - features/hooks/before_and_after_hooks.feature
@@ -189,8 +196,8 @@ files:
189
196
  - features/subject/implicit_subject.feature
190
197
  - features/support/env.rb
191
198
  - lib/autotest/rspec2.rb
199
+ - lib/rspec/autorun.rb
192
200
  - lib/rspec/core.rb
193
- - lib/rspec/core/around_proxy.rb
194
201
  - lib/rspec/core/backward_compatibility.rb
195
202
  - lib/rspec/core/command_line.rb
196
203
  - lib/rspec/core/command_line_configuration.rb
@@ -206,7 +213,6 @@ files:
206
213
  - lib/rspec/core/extensions/kernel.rb
207
214
  - lib/rspec/core/extensions/module_eval_with_args.rb
208
215
  - lib/rspec/core/extensions/object.rb
209
- - lib/rspec/core/formatters.rb
210
216
  - lib/rspec/core/formatters/base_formatter.rb
211
217
  - lib/rspec/core/formatters/base_text_formatter.rb
212
218
  - lib/rspec/core/formatters/documentation_formatter.rb
@@ -299,7 +305,7 @@ licenses: []
299
305
  post_install_message: |
300
306
  **************************************************
301
307
 
302
- Thank you for installing rspec-core-2.0.0.beta.22
308
+ Thank you for installing rspec-core-2.0.0.rc
303
309
 
304
310
  Please be sure to look at Upgrade.markdown to see what might have changed
305
311
  since the last release.
@@ -315,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
315
321
  requirements:
316
322
  - - ">="
317
323
  - !ruby/object:Gem::Version
318
- hash: 2227276368104417494
324
+ hash: 3
319
325
  segments:
320
326
  - 0
321
327
  version: "0"
@@ -324,6 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
330
  requirements:
325
331
  - - ">"
326
332
  - !ruby/object:Gem::Version
333
+ hash: 25
327
334
  segments:
328
335
  - 1
329
336
  - 3
@@ -335,7 +342,7 @@ rubyforge_project: rspec
335
342
  rubygems_version: 1.3.7
336
343
  signing_key:
337
344
  specification_version: 3
338
- summary: rspec-core-2.0.0.beta.22
345
+ summary: rspec-core-2.0.0.rc
339
346
  test_files:
340
347
  - features/README.markdown
341
348
  - features/command_line/configure.feature
@@ -343,13 +350,15 @@ test_files:
343
350
  - features/command_line/exit_status.feature
344
351
  - features/command_line/line_number_appended_to_path.feature
345
352
  - features/command_line/line_number_option.feature
353
+ - features/command_line/rake_task.feature
346
354
  - features/configuration/custom_settings.feature
355
+ - features/configuration/fail_fast.feature
347
356
  - features/configuration/read_options_from_file.feature
348
- - features/example_groups/describe_aliases.feature
349
- - features/example_groups/nested_groups.feature
357
+ - features/example_groups/basic_structure.feature
350
358
  - features/example_groups/shared_example_group.feature
351
359
  - features/filtering/exclusion_filters.feature
352
360
  - features/filtering/inclusion_filters.feature
361
+ - features/filtering/run_all_when_everything_filtered.feature
353
362
  - features/formatters/custom_formatter.feature
354
363
  - features/hooks/around_hooks.feature
355
364
  - features/hooks/before_and_after_hooks.feature