rspec-core 2.4.0 → 2.5.0

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 (78) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +9 -4
  3. data/Guardfile +3 -3
  4. data/README.md +1 -1
  5. data/features/.nav +7 -2
  6. data/features/{README.markdown → Autotest.md} +17 -20
  7. data/features/Changelog.md +57 -2
  8. data/features/README.md +17 -0
  9. data/features/Upgrade.md +8 -66
  10. data/features/command_line/configure.feature +2 -2
  11. data/features/command_line/example_name_option.feature +10 -10
  12. data/features/command_line/exit_status.feature +4 -4
  13. data/features/command_line/line_number_appended_to_path.feature +11 -11
  14. data/features/command_line/line_number_option.feature +9 -9
  15. data/features/command_line/tag.feature +9 -9
  16. data/features/configuration/custom_settings.feature +3 -3
  17. data/features/configuration/fail_fast.feature +3 -3
  18. data/features/configuration/read_options_from_file.feature +4 -4
  19. data/features/example_groups/shared_example_group.feature +4 -4
  20. data/features/expectation_framework_integration/configure_expectation_framework.feature +8 -9
  21. data/features/filtering/exclusion_filters.feature +1 -1
  22. data/features/filtering/run_all_when_everything_filtered.feature +1 -1
  23. data/features/formatters/custom_formatter.feature +17 -13
  24. data/features/helper_methods/arbitrary_methods.feature +40 -0
  25. data/features/helper_methods/let.feature +50 -0
  26. data/features/hooks/before_and_after_hooks.feature +10 -10
  27. data/features/hooks/filtering.feature +37 -20
  28. data/features/metadata/described_class.feature +1 -1
  29. data/features/mock_framework_integration/use_flexmock.feature +1 -1
  30. data/features/mock_framework_integration/use_mocha.feature +1 -1
  31. data/features/mock_framework_integration/use_rr.feature +1 -1
  32. data/features/mock_framework_integration/use_rspec.feature +1 -1
  33. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  34. data/features/step_definitions/additional_cli_steps.rb +1 -1
  35. data/features/subject/attribute_of_subject.feature +2 -2
  36. data/features/subject/explicit_subject.feature +5 -5
  37. data/features/subject/implicit_receiver.feature +2 -2
  38. data/features/subject/implicit_subject.feature +2 -2
  39. data/lib/autotest/rspec2.rb +63 -13
  40. data/lib/rspec/core/configuration.rb +0 -1
  41. data/lib/rspec/core/configuration_options.rb +15 -12
  42. data/lib/rspec/core/example.rb +14 -6
  43. data/lib/rspec/core/example_group.rb +5 -4
  44. data/lib/rspec/core/formatters/base_formatter.rb +1 -1
  45. data/lib/rspec/core/formatters/documentation_formatter.rb +1 -1
  46. data/lib/rspec/core/formatters/html_formatter.rb +131 -32
  47. data/lib/rspec/core/formatters/snippet_extractor.rb +1 -1
  48. data/lib/rspec/core/hooks.rb +16 -1
  49. data/lib/rspec/core/option_parser.rb +6 -6
  50. data/lib/rspec/core/rake_task.rb +1 -1
  51. data/lib/rspec/core/subject.rb +7 -7
  52. data/lib/rspec/core/version.rb +1 -1
  53. data/rspec-core.gemspec +0 -12
  54. data/script/FullBuildRakeFile +63 -0
  55. data/script/cucumber +1 -0
  56. data/script/full_build +1 -0
  57. data/script/spec +1 -0
  58. data/spec/autotest/failed_results_re_spec.rb +22 -5
  59. data/spec/autotest/rspec_spec.rb +132 -16
  60. data/spec/rspec/core/configuration_options_spec.rb +38 -6
  61. data/spec/rspec/core/example_group_spec.rb +15 -64
  62. data/spec/rspec/core/formatters/base_formatter_spec.rb +23 -0
  63. data/spec/rspec/core/formatters/html_formatted-1.8.6.html +150 -48
  64. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +151 -49
  65. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +150 -48
  66. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +150 -48
  67. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +150 -48
  68. data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +150 -48
  69. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +151 -49
  70. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +150 -48
  71. data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +150 -48
  72. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +150 -48
  73. data/spec/rspec/core/hooks_filtering_spec.rb +49 -0
  74. data/spec/rspec/core/rake_task_spec.rb +3 -3
  75. data/spec/rspec/core/subject_spec.rb +81 -0
  76. metadata +20 -22
  77. data/History.markdown +0 -186
  78. data/Upgrade.markdown +0 -345
@@ -67,6 +67,55 @@ module RSpec::Core
67
67
  ]
68
68
  end
69
69
 
70
+ it "runs before|after :all hooks on matching nested example groups" do
71
+ filters = []
72
+ RSpec.configure do |c|
73
+ c.before(:all, :match => true) { filters << :before_all }
74
+ c.after(:all, :match => true) { filters << :after_all }
75
+ end
76
+
77
+ example_1_filters = example_2_filters = nil
78
+
79
+ group = ExampleGroup.describe "group" do
80
+ it("example 1") { example_1_filters = filters.dup }
81
+ describe "subgroup", :match => true do
82
+ it("example 2") { example_2_filters = filters.dup }
83
+ end
84
+ end
85
+ group.run
86
+
87
+ example_1_filters.should be_empty
88
+ example_2_filters.should == [:before_all]
89
+ filters.should == [:before_all, :after_all]
90
+ end
91
+
92
+ it "runs before|after :all hooks only on the highest level group that matches the filter" do
93
+ filters = []
94
+ RSpec.configure do |c|
95
+ c.before(:all, :match => true) { filters << :before_all }
96
+ c.after(:all, :match => true) { filters << :after_all }
97
+ end
98
+
99
+ example_1_filters = example_2_filters = example_3_filters = nil
100
+
101
+ group = ExampleGroup.describe "group", :match => true do
102
+ it("example 1") { example_1_filters = filters.dup }
103
+ describe "subgroup", :match => true do
104
+ it("example 2") { example_2_filters = filters.dup }
105
+ describe "sub-subgroup", :match => true do
106
+ it("example 3") { example_3_filters = filters.dup }
107
+ end
108
+ end
109
+ end
110
+ group.run
111
+
112
+ example_1_filters.should == [:before_all]
113
+ example_2_filters.should == [:before_all]
114
+ example_3_filters.should == [:before_all]
115
+
116
+ filters.should == [:before_all, :after_all]
117
+ end
118
+
70
119
  it "should not be ran if the filter doesn't match the example group's filter" do
71
120
  filters = []
72
121
  RSpec.configure do |c|
@@ -144,16 +144,16 @@ module RSpec::Core
144
144
  @task = RakeTask.new do |t|
145
145
  t.pattern = File.join(@tmp_dir, "*spec.rb")
146
146
  end
147
- ["first_spec.rb", "second_\"spec.rb", "third_'spec.rb"].each do |file_name|
147
+ ["first_spec.rb", "second_\"spec.rb", "third_\'spec.rb"].each do |file_name|
148
148
  FileUtils.touch(File.join(@tmp_dir, file_name))
149
149
  end
150
150
  end
151
151
 
152
152
  it "escapes the quotes" do
153
- @task.__send__(:files_to_run).should eq([
153
+ @task.__send__(:files_to_run).sort.should eq([
154
154
  File.join(@tmp_dir, "first_spec.rb"),
155
155
  File.join(@tmp_dir, "second_\\\"spec.rb"),
156
- File.join(@tmp_dir, "third_\\'spec.rb")
156
+ File.join(@tmp_dir, "third_\\\'spec.rb")
157
157
  ])
158
158
  end
159
159
  end
@@ -93,5 +93,86 @@ module RSpec::Core
93
93
  end
94
94
  end
95
95
 
96
+ describe "#its" do
97
+ subject do
98
+ Class.new do
99
+ def initialize
100
+ @call_count = 0
101
+ end
102
+
103
+ def call_count
104
+ @call_count += 1
105
+ end
106
+ end.new
107
+ end
108
+
109
+ context "with a call counter" do
110
+ its(:call_count) { should eq(1) }
111
+ end
112
+
113
+ context "with nil value" do
114
+ subject do
115
+ Class.new do
116
+ def nil_value
117
+ nil
118
+ end
119
+ end.new
120
+ end
121
+ its(:nil_value) { should be_nil }
122
+ end
123
+
124
+ context "with nested attributes" do
125
+ subject do
126
+ Class.new do
127
+ def name
128
+ "John"
129
+ end
130
+ end.new
131
+ end
132
+ its("name") { should eq("John") }
133
+ its("name.size") { should eq(4) }
134
+ its("name.size.class") { should eq(Fixnum) }
135
+ end
136
+
137
+ context "when it is a Hash" do
138
+ subject do
139
+ { :attribute => 'value',
140
+ 'another_attribute' => 'another_value' }
141
+ end
142
+ its([:attribute]) { should == 'value' }
143
+ its([:attribute]) { should_not == 'another_value' }
144
+ its([:another_attribute]) { should == 'another_value' }
145
+ its([:another_attribute]) { should_not == 'value' }
146
+ its(:keys) { should =~ ['another_attribute', :attribute] }
147
+ context "when referring to an attribute without the proper array syntax" do
148
+ context "it raises an error" do
149
+ its(:attribute) do
150
+ expect do
151
+ should eq('value')
152
+ end.to raise_error(NoMethodError)
153
+ end
154
+ end
155
+ end
156
+ end
157
+
158
+ context "calling and overriding super" do
159
+ it "calls to the subject defined in the parent group" do
160
+ group = ExampleGroup.describe(Array) do
161
+ subject { [1, 'a'] }
162
+
163
+ its(:last) { should == 'a' }
164
+
165
+ describe '.first' do
166
+ def subject; super().first; end
167
+
168
+ its(:next) { should == 2 }
169
+ end
170
+ end
171
+
172
+ group.run.should be_true
173
+ end
174
+ end
175
+
176
+ end
96
177
  end
97
178
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
7
- - 4
8
+ - 5
8
9
  - 0
9
- version: 2.4.0
10
+ version: 2.5.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Chad Humphries
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-01-02 00:00:00 -06:00
19
+ date: 2011-02-05 00:00:00 -06:00
19
20
  default_executable: rspec
20
21
  dependencies: []
21
22
 
@@ -34,17 +35,16 @@ files:
34
35
  - .rspec
35
36
  - Gemfile
36
37
  - Guardfile
37
- - History.markdown
38
38
  - License.txt
39
39
  - README.md
40
40
  - Rakefile
41
- - Upgrade.markdown
42
41
  - bin/autospec
43
42
  - bin/rspec
44
43
  - cucumber.yml
45
44
  - features/.nav
45
+ - features/Autotest.md
46
46
  - features/Changelog.md
47
- - features/README.markdown
47
+ - features/README.md
48
48
  - features/Upgrade.md
49
49
  - features/command_line/README.md
50
50
  - features/command_line/configure.feature
@@ -66,6 +66,8 @@ files:
66
66
  - features/filtering/inclusion_filters.feature
67
67
  - features/filtering/run_all_when_everything_filtered.feature
68
68
  - features/formatters/custom_formatter.feature
69
+ - features/helper_methods/arbitrary_methods.feature
70
+ - features/helper_methods/let.feature
69
71
  - features/hooks/around_hooks.feature
70
72
  - features/hooks/before_and_after_hooks.feature
71
73
  - features/hooks/filtering.feature
@@ -135,7 +137,11 @@ files:
135
137
  - lib/rspec/monkey.rb
136
138
  - lib/rspec/monkey/spork/test_framework/rspec.rb
137
139
  - rspec-core.gemspec
140
+ - script/FullBuildRakeFile
138
141
  - script/console
142
+ - script/cucumber
143
+ - script/full_build
144
+ - script/spec
139
145
  - spec/autotest/discover_spec.rb
140
146
  - spec/autotest/failed_results_re_spec.rb
141
147
  - spec/autotest/rspec_spec.rb
@@ -195,18 +201,7 @@ has_rdoc: true
195
201
  homepage: http://github.com/rspec/rspec-core
196
202
  licenses: []
197
203
 
198
- post_install_message: |
199
- **************************************************
200
-
201
- Thank you for installing rspec-core-2.4.0
202
-
203
- Please be sure to look at the upgrade instructions to see what might have
204
- changed since the last release:
205
-
206
- http://github.com/rspec/rspec-core/blob/master/Upgrade.markdown
207
-
208
- **************************************************
209
-
204
+ post_install_message:
210
205
  rdoc_options:
211
206
  - --charset=UTF-8
212
207
  require_paths:
@@ -216,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
211
  requirements:
217
212
  - - ">="
218
213
  - !ruby/object:Gem::Version
219
- hash: -2078770965250324300
214
+ hash: 3
220
215
  segments:
221
216
  - 0
222
217
  version: "0"
@@ -225,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
220
  requirements:
226
221
  - - ">="
227
222
  - !ruby/object:Gem::Version
228
- hash: -2078770965250324300
223
+ hash: 3
229
224
  segments:
230
225
  - 0
231
226
  version: "0"
@@ -235,10 +230,11 @@ rubyforge_project: rspec
235
230
  rubygems_version: 1.3.7
236
231
  signing_key:
237
232
  specification_version: 3
238
- summary: rspec-core-2.4.0
233
+ summary: rspec-core-2.5.0
239
234
  test_files:
235
+ - features/Autotest.md
240
236
  - features/Changelog.md
241
- - features/README.markdown
237
+ - features/README.md
242
238
  - features/Upgrade.md
243
239
  - features/command_line/README.md
244
240
  - features/command_line/configure.feature
@@ -260,6 +256,8 @@ test_files:
260
256
  - features/filtering/inclusion_filters.feature
261
257
  - features/filtering/run_all_when_everything_filtered.feature
262
258
  - features/formatters/custom_formatter.feature
259
+ - features/helper_methods/arbitrary_methods.feature
260
+ - features/helper_methods/let.feature
263
261
  - features/hooks/around_hooks.feature
264
262
  - features/hooks/before_and_after_hooks.feature
265
263
  - features/hooks/filtering.feature
@@ -1,186 +0,0 @@
1
- ## rspec-core release history (incomplete)
2
-
3
- ### 2.4.0 / 2011-01-02
4
-
5
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.3.1...v2.4.0)
6
-
7
- * Enhancements
8
- * start the debugger on -d so the stack trace is visible when it stops
9
- (Clifford Heath)
10
- * apply hook filtering to examples as well as groups (Myron Marston)
11
- * support multiple formatters, each with their own output
12
- * show exception classes in failure messages unless they come from RSpec
13
- matchers or message expectations
14
- * before(:all) { pending } sets all examples to pending
15
-
16
- * Bug fixes
17
- * fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota Fukumori)
18
- * fix bug when running in jruby: be explicit about passing block to super
19
- (John Firebaugh)
20
- * rake task doesn't choke on paths with quotes (Janmejay Singh)
21
- * restore --options option from rspec-1
22
- * require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
23
- * --configure option generates .rspec file instead of autotest/discover.rb
24
-
25
- ### 2.3.1 / 2010-12-16
26
-
27
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.3.0...v2.3.1)
28
-
29
- * Bug fixes
30
- * send debugger warning message to $stdout if RSpec.configuration.error_stream
31
- has not been defined yet.
32
- * HTML Formatter _finally_ properly displays nested groups (Jarmo Pertman)
33
- * eliminate some warnings when running RSpec's own suite (Jarmo Pertman)
34
-
35
- ### 2.3.0 / 2010-12-12
36
-
37
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.2.1...v2.3.0)
38
-
39
- * Enhancements
40
- * tell autotest to use "rspec2" if it sees a .rspec file in the project's
41
- root directory
42
- * replaces the need for ./autotest/discover.rb, which will not work with
43
- all versions of ZenTest and/or autotest
44
- * config.expect_with
45
- * :rspec # => rspec/expectations
46
- * :stdlib # => test/unit/assertions
47
- * :rspec, :stdlib # => both
48
-
49
- * Bug fixes
50
- * fix dev Gemfile to work on non-mac-os machines (Lake Denman)
51
- * ensure explicit subject is only eval'd once (Laszlo Bacsi)
52
-
53
- ### 2.2.1 / 2010-11-28
54
-
55
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...v2.2.1)
56
-
57
- * Bug fixes
58
- * alias_method instead of override Kernel#method_missing (John Wilger)
59
- * changed --autotest to --tty in generated command (MIKAMI Yoshiyuki)
60
- * revert change to debugger (had introduced conflict with Rails)
61
- * also restored --debugger/-debug option
62
-
63
- ### 2.2.0 / 2010-11-28
64
-
65
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.1.0...v2.2.0)
66
-
67
- * Deprecations/changes
68
- * --debug/-d on command line is deprecated and now has no effect
69
- * win32console is now ignored; Windows users must use ANSICON for color support
70
- (Bosko Ivanisevic)
71
-
72
- * Enhancements
73
- * When developing locally rspec-core now works with the rspec-dev setup or your local gems
74
- * Raise exception with helpful message when rspec-1 is loaded alongside
75
- rspec-2 (Justin Ko)
76
- * debugger statements _just work_ as long as ruby-debug is installed
77
- * otherwise you get warned, but not fired
78
- * Expose example.metadata in around hooks
79
- * Performance improvments (see [Upgrade.markdown](https://github.com/rspec/rspec-core/blob/master/Upgrade.markdown))
80
-
81
- * Bug fixes
82
- * Make sure --fail-fast makes it across drb
83
- * Pass -Ilib:spec to rcov
84
-
85
- ### 2.1.0 / 2010-11-07
86
-
87
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.0.1...v2.1.0)
88
-
89
- * Enhancments
90
- * Add skip_bundler option to rake task to tell rake task to ignore the
91
- presence of a Gemfile (jfelchner)
92
- * Add gemfile option to rake task to tell rake task what Gemfile to look
93
- for (defaults to 'Gemfile')
94
- * Allow passing caller trace into Metadata to support extensions (Glenn
95
- Vanderburg)
96
- * Add deprecation warning for Spec::Runner.configure to aid upgrade from
97
- RSpec-1
98
- * Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
99
- * Add 'autospec' command with helpful message to aid upgrade from RSpec-1
100
- * Add support for filtering with tags on CLI (Lailson Bandeira)
101
- * Add a helpful message about RUBYOPT when require fails in bin/rspec
102
- (slyphon)
103
- * Add "-Ilib" to the default rcov options (Tianyi Cui)
104
- * Make the expectation framework configurable (default rspec, of course)
105
- (Justin Ko)
106
- * Add 'pending' to be conditional (Myron Marston)
107
- * Add explicit support for :if and :unless as metadata keys for conditional run
108
- of examples (Myron Marston)
109
- * Add --fail-fast command line option (Jeff Kreeftmeijer)
110
-
111
- * Bug fixes
112
- * Eliminate stack overflow with "subject { self }"
113
- * Require 'rspec/core' in the Raketask (ensures it required when running rcov)
114
-
115
- ### 2.0.1 / 2010-10-18
116
-
117
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0...v2.0.1)
118
-
119
- * Bug fixes
120
- * Restore color when using spork + autotest
121
- * Pending examples without docstrings render the correct message (Josep M. Bach)
122
- * Fixed bug where a failure in a spec file ending in anything but _spec.rb would
123
- fail in a confusing way.
124
- * Support backtrace lines from erb templates in html formatter (Alex Crichton)
125
-
126
- ### 2.0.0 / 2010-10-10
127
-
128
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.rc...v2.0.0)
129
-
130
- * RSpec-1 compatibility
131
- * Rake task uses ENV["SPEC"] as file list if present
132
-
133
- * Bug fixes
134
- * Bug Fix: optparse --out foo.txt (Leonardo Bessa)
135
- * Suppress color codes for non-tty output (except autotest)
136
-
137
- ### 2.0.0.rc / 2010-10-05
138
-
139
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.22...v2.0.0.rc)
140
-
141
- * Enhancements
142
- * implicitly require unknown formatters so you don't have to require the
143
- file explicitly on the commmand line (Michael Grosser)
144
- * add --out/-o option to assign output target
145
- * added fail_fast configuration option to abort on first failure
146
- * support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
147
-
148
- * Bug fixes
149
- * Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
150
- * Ignore backtrace lines that come from other languages, like Java or
151
- Javascript (Charles Lowell)
152
- * Rake task now does what is expected when setting (or not setting)
153
- fail_on_error and verbose
154
- * Fix bug in which before/after(:all) hooks were running on excluded nested
155
- groups (Myron Marston)
156
- * Fix before(:all) error handling so that it fails examples in nested groups,
157
- too (Myron Marston)
158
-
159
- ### 2.0.0.beta.22 / 2010-09-12
160
-
161
- [full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.20...v2.0.0.beta.22)
162
-
163
- * Enhancements
164
- * removed at_exit hook
165
- * CTRL-C stops the run (almost) immediately
166
- * first it cleans things up by running the appropriate after(:all) and after(:suite) hooks
167
- * then it reports on any examples that have already run
168
- * cleaned up rake task
169
- * generate correct task under variety of conditions
170
- * options are more consistent
171
- * deprecated redundant options
172
- * run 'bundle exec autotest' when Gemfile is present
173
- * support ERB in .rspec options files (Justin Ko)
174
- * depend on bundler for development tasks (Myron Marston)
175
- * add example_group_finished to formatters and reporter (Roman Chernyatchik)
176
-
177
- * Bug fixes
178
- * support paths with spaces when using autotest (Andreas Neuhaus)
179
- * fix module_exec with ruby 1.8.6 (Myron Marston)
180
- * remove context method from top-level
181
- * was conflicting with irb, for example
182
- * errors in before(:all) are now reported correctly (Chad Humphries)
183
-
184
- * Removals
185
- * removed -o --options-file command line option
186
- * use ./.rspec and ~/.rspec