rspec 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,18 @@
1
1
  = RSpec Changelog
2
2
 
3
+ == Version 0.9.4
4
+ This release introduces massive improvements to Spec::Ui - the user interface functional testing
5
+ extension to RSpec. There are also some minor bug fixes to the RSpec core.
6
+
7
+ * Massive improvements to Spec::Ui. Complete support for all Watir's ie.xxx(how, what) methods. Inline screenshots and HTML.
8
+ * Reactivated --timeout, which had mysteriously been deactivated in a recent release.
9
+ * Fixed [#10669] Kernel#describe override does not cover Kernel#context
10
+ * Applied [#10636] Added spec for OptionParser in Runner (Patch from Scott Taylor)
11
+ * Added [#10516] should_include should be able to accept multiple items
12
+ * Applied [#10631] redirect_to matcher doesn't respect request.host (Patch from Tim Lucas)
13
+ * Each formatter now flushes their own IO. This is to avoid buffering of output.
14
+ * Fixed [#10670] IVarProxy#delete raises exception when instance variable does not exist
15
+
3
16
  == Version 0.9.3
4
17
  This is a bugfix release.
5
18
 
@@ -99,6 +99,6 @@
99
99
  # * RSpec should be able to access TestCase methods
100
100
  # * RSpec should be able to accept included modules
101
101
 
102
- Finished in 0.030655 seconds
102
+ Finished in 0.030613 seconds
103
103
 
104
104
  74 examples, 0 failures
data/Rakefile CHANGED
@@ -29,7 +29,12 @@ task :default => [:verify_rcov]
29
29
 
30
30
  desc "Run all specs"
31
31
  Spec::Rake::SpecTask.new do |t|
32
- t.spec_files = FileList['spec/**/*_spec.rb', '../RSpec.tmbundle/Support/spec/*_spec.rb']
32
+ t.spec_files = FileList[
33
+ 'spec/**/*_spec.rb',
34
+ '../RSpec.tmbundle/Support/spec/*_spec.rb'
35
+ # TODO: get these in too - need to fix coverage
36
+ # '../spec_ui/spec/**/*_spec.rb'
37
+ ]
33
38
  t.spec_opts = ['--options', 'spec.opts']
34
39
  t.rcov = true
35
40
  t.rcov_dir = '../doc/output/coverage'
@@ -55,7 +55,7 @@ module Spec
55
55
  public
56
56
 
57
57
  def run(reporter, dry_run=false, reverse=false, timeout=nil)
58
- return if shared?
58
+ raise "shared behaviours should never run" if shared?
59
59
  reporter.add_behaviour(description)
60
60
  prepare_execution_context_class
61
61
  errors = run_before_all(reporter, dry_run)
@@ -13,9 +13,11 @@ module Spec
13
13
  derive_execution_context_class_from_behaviour_superclass
14
14
  end
15
15
 
16
- def include(mod)
17
- included_modules << mod
18
- mod.send :included, self
16
+ def include(*mods)
17
+ mods.each do |mod|
18
+ included_modules << mod
19
+ mod.send :included, self
20
+ end
19
21
  end
20
22
 
21
23
  def it_should_behave_like(behaviour_description)
@@ -123,10 +125,6 @@ module Spec
123
125
  CompositeProcBuilder.new(parts).proc(&error_handler)
124
126
  end
125
127
 
126
- def add_superclass_method(parts, method_name)
127
- parts << behaviour_superclass.instance_method(method_name) if behaviour_superclass.instance_methods.include?(method_name)
128
- end
129
-
130
128
  private
131
129
 
132
130
  def execution_context_class
@@ -15,8 +15,9 @@ module Spec
15
15
  @mock_framework ||= mock_framework_path("rspec")
16
16
  end
17
17
 
18
- def include(mod)
19
- included_modules << mod
18
+ def include(*mods)
19
+ # mods.each {|mod|included_modules << mod}
20
+ included_modules.push(*mods)
20
21
  end
21
22
 
22
23
  def included_modules
@@ -3,13 +3,16 @@ module Spec
3
3
 
4
4
  class Include #:nodoc:
5
5
 
6
- def initialize(expected)
7
- @expected = expected
6
+ def initialize(*expecteds)
7
+ @expecteds = expecteds
8
8
  end
9
9
 
10
10
  def matches?(actual)
11
11
  @actual = actual
12
- actual.include?(@expected)
12
+ @expecteds.each do |expected|
13
+ return false unless actual.include?(expected)
14
+ end
15
+ true
13
16
  end
14
17
 
15
18
  def failure_message
@@ -21,12 +24,26 @@ module Spec
21
24
  end
22
25
 
23
26
  def description
24
- "include #{@expected.inspect}"
27
+ "include #{_pretty_print(@expecteds)}"
25
28
  end
26
29
 
27
30
  private
28
31
  def _message(maybe_not="")
29
- "expected #{@actual.inspect} #{maybe_not}to include #{@expected.inspect}"
32
+ "expected #{@actual.inspect} #{maybe_not}to include #{_pretty_print(@expecteds)}"
33
+ end
34
+
35
+ def _pretty_print(array)
36
+ result = ""
37
+ array.each_with_index do |item, index|
38
+ if index < (array.length - 2)
39
+ result << "#{item.inspect}, "
40
+ elsif index < (array.length - 1)
41
+ result << "#{item.inspect} and "
42
+ else
43
+ result << "#{item.inspect}"
44
+ end
45
+ end
46
+ result
30
47
  end
31
48
  end
32
49
 
@@ -35,16 +52,19 @@ module Spec
35
52
  # should_not include(expected)
36
53
  #
37
54
  # Passes if actual includes expected. This works for
38
- # collections and Strings
55
+ # collections and Strings. You can also pass in multiple args
56
+ # and it will only pass if all args are found in collection.
39
57
  #
40
58
  # == Examples
41
59
  #
42
60
  # [1,2,3].should include(3)
61
+ # [1,2,3].should include(2,3) #would pass
62
+ # [1,2,3].should include(2,3,4) #would fail
43
63
  # [1,2,3].should_not include(4)
44
64
  # "spread".should include("read")
45
65
  # "spread".should_not include("red")
46
- def include(expected)
47
- Matchers::Include.new(expected)
66
+ def include(*expected)
67
+ Matchers::Include.new(*expected)
48
68
  end
49
69
  end
50
70
  end
@@ -11,7 +11,7 @@ module Spec
11
11
  unless specified_examples.nil? || specified_examples.empty? #|| behaviour.matches?(specified_examples)
12
12
  behaviour.retain_examples_matching!(specified_examples) #if behaviour.matches?(specified_examples)
13
13
  end
14
- @behaviours << behaviour unless behaviour.number_of_examples == 0
14
+ @behaviours << behaviour if behaviour.number_of_examples != 0 && !behaviour.shared?
15
15
  end
16
16
 
17
17
  # Runs all contexts and returns the number of failures.
@@ -42,7 +42,7 @@ module Spec
42
42
 
43
43
  def run_behaviours(behaviours)
44
44
  behaviours.each do |behaviour|
45
- behaviour.run(@options.reporter, @options.dry_run, @options.reverse)
45
+ behaviour.run(@options.reporter, @options.dry_run, @options.reverse, @options.timeout)
46
46
  end
47
47
  end
48
48
 
@@ -16,6 +16,9 @@ module Spec
16
16
  @output = File.open(where, 'w')
17
17
  elsif where == STDOUT
18
18
  @output = Kernel
19
+ def @output.flush
20
+ STDOUT.flush
21
+ end
19
22
  else
20
23
  @output = where
21
24
  end
@@ -40,6 +43,7 @@ module Spec
40
43
  @output.puts magenta(failure.exception.message)
41
44
  end
42
45
  @output.puts format_backtrace(failure.exception.backtrace)
46
+ @output.flush
43
47
  end
44
48
 
45
49
  def dump_summary(duration, example_count, failure_count)
@@ -53,6 +57,7 @@ module Spec
53
57
  else
54
58
  @output.puts red(summary)
55
59
  end
60
+ @output.flush
56
61
  end
57
62
 
58
63
  def format_backtrace(backtrace)
@@ -10,6 +10,7 @@ module Spec
10
10
  unless @behaviour_name.nil?
11
11
  @output.puts @behaviour_name
12
12
  @behaviour_name = nil
13
+ @output.flush
13
14
  end
14
15
  end
15
16
 
@@ -8,6 +8,7 @@ module Spec
8
8
 
9
9
  def example_failed(name, counter, failure)
10
10
  @output.puts "#{@behaviour_name} #{name}"
11
+ @output.flush
11
12
  end
12
13
 
13
14
  def dump_failure(counter, failure)
@@ -7,7 +7,6 @@ module Spec
7
7
  super
8
8
  @current_behaviour_number = 0
9
9
  @current_example_number = 0
10
- @html_header = true
11
10
  end
12
11
 
13
12
  # The number of the currently running behaviour
@@ -23,10 +22,9 @@ module Spec
23
22
  def start(example_count)
24
23
  @example_count = example_count
25
24
 
26
- if(@html_header)
27
- @output.puts HTML_HEADER
28
- end
29
- @output.puts REPORT_HEADER
25
+ @output.puts html_header
26
+ @output.puts report_header
27
+ @output.flush
30
28
  end
31
29
 
32
30
  def add_behaviour(name)
@@ -38,17 +36,20 @@ module Spec
38
36
  @output.puts "<div class=\"behaviour\">"
39
37
  @output.puts " <dl>"
40
38
  @output.puts " <dt id=\"behaviour_#{current_behaviour_number}\">#{escape(name)}</dt>"
39
+ @output.flush
41
40
  end
42
41
 
43
42
  def start_dump
44
43
  @output.puts " </dl>"
45
44
  @output.puts "</div>"
45
+ @output.flush
46
46
  end
47
47
 
48
48
  def example_passed(name)
49
49
  @current_example_number += 1
50
50
  move_progress
51
51
  @output.puts " <dd class=\"spec passed\"><span class=\"passed_spec_name\">#{escape(name)}</span></dd>"
52
+ @output.flush
52
53
  end
53
54
 
54
55
  def example_failed(name, counter, failure)
@@ -66,6 +67,7 @@ module Spec
66
67
  @output.puts extra unless extra == ""
67
68
  @output.puts " </div>"
68
69
  @output.puts " </dd>"
70
+ @output.flush
69
71
  end
70
72
 
71
73
  # Override this method if you wish to output extra HTML for a failed spec. For example, you
@@ -78,6 +80,7 @@ module Spec
78
80
  def move_progress
79
81
  percent_done = @example_count == 0 ? 100.0 : (current_example_number.to_f / @example_count.to_f * 1000).to_i / 10.0
80
82
  @output.puts " <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
83
+ @output.flush
81
84
  end
82
85
 
83
86
  def escape(string)
@@ -97,13 +100,13 @@ module Spec
97
100
  @output.puts "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
98
101
  @output.puts "</div>"
99
102
  @output.puts "</div>"
100
- if(@html_header)
101
- @output.puts "</body>"
102
- @output.puts "</html>"
103
- end
103
+ @output.puts "</body>"
104
+ @output.puts "</html>"
105
+ @output.flush
104
106
  end
105
107
 
106
- HTML_HEADER = <<-EOF
108
+ def html_header
109
+ <<-EOF
107
110
  <?xml version="1.0" encoding="iso-8859-1"?>
108
111
  <!DOCTYPE html
109
112
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -124,136 +127,153 @@ module Spec
124
127
  </head>
125
128
  <body>
126
129
  EOF
130
+ end
127
131
 
128
- REPORT_HEADER = <<-EOF
132
+ def report_header
133
+ <<-EOF
129
134
  <div class="rspec-report">
130
135
  <script type="text/javascript">
131
- function moveProgressBar(percentDone) {
132
- document.getElementById("rspec-header").style.width = percentDone +"%";
133
- }
134
- function makeRed(element_id) {
135
- document.getElementById(element_id).style.background = '#C40D0D';
136
- }
136
+ // <![CDATA[
137
+ #{global_scripts}
138
+ // ]]>
137
139
  </script>
138
140
  <style type="text/css">
139
- #rspec-header {
140
- background: #65C400; color: #fff;
141
- }
141
+ #{global_styles}
142
+ </style>
142
143
 
143
- div.rspec-report h1 {
144
- margin: 0 0 10px;
145
- padding: 10px;
146
- font: bold 18px "Lucida Grande", Helvetica, sans-serif;
147
- }
144
+ <div id="rspec-header">
145
+ <h1>RSpec Results</h1>
148
146
 
149
- #summary {
150
- margin: 0; padding: 5px 10px;
151
- font: bold 10px "Lucida Grande", Helvetica, sans-serif;
152
- text-align: right;
153
- position: absolute;
154
- top: 0px;
155
- right: 0px;
156
- }
147
+ <div id="summary">
148
+ <p id="duration">&nbsp;</p>
149
+ <p id="totals">&nbsp;</p>
150
+ </div>
151
+ </div>
157
152
 
158
- #summary p {
159
- margin: 0 0 2px;
160
- }
153
+ <div class="results">
154
+ EOF
155
+ end
161
156
 
162
- #summary #totals {
163
- font-size: 14px;
164
- }
157
+ def global_scripts
158
+ <<-EOF
159
+ function moveProgressBar(percentDone) {
160
+ document.getElementById("rspec-header").style.width = percentDone +"%";
161
+ }
162
+ function makeRed(element_id) {
163
+ document.getElementById(element_id).style.background = '#C40D0D';
164
+ }
165
+ EOF
166
+ end
167
+
168
+ def global_styles
169
+ <<-EOF
170
+ #rspec-header {
171
+ background: #65C400; color: #fff;
172
+ }
165
173
 
166
- .behaviour {
167
- margin: 0 10px 5px;
168
- background: #fff;
169
- }
174
+ div.rspec-report h1 {
175
+ margin: 0px 10px 0px 10px;
176
+ padding: 10px;
177
+ font: bold 18px "Lucida Grande", Helvetica, sans-serif;
178
+ }
170
179
 
171
- dl {
172
- margin: 0; padding: 0 0 5px;
173
- font: normal 11px "Lucida Grande", Helvetica, sans-serif;
174
- }
180
+ #summary {
181
+ margin: 0; padding: 5px 10px;
182
+ font: bold 10px "Lucida Grande", Helvetica, sans-serif;
183
+ text-align: right;
184
+ position: absolute;
185
+ top: 0px;
186
+ right: 0px;
187
+ }
175
188
 
176
- dt {
177
- padding: 3px;
178
- background: #65C400;
179
- color: #fff;
180
- font-weight: bold;
181
- }
189
+ #summary p {
190
+ margin: 0 0 2px;
191
+ }
182
192
 
183
- dd {
184
- margin: 5px 0 5px 5px;
185
- padding: 3px 3px 3px 18px;
186
- }
193
+ #summary #totals {
194
+ font-size: 14px;
195
+ }
187
196
 
188
- dd.spec.passed {
189
- border-left: 5px solid #65C400;
190
- border-bottom: 1px solid #65C400;
191
- background: #DBFFB4; color: #3D7700;
192
- }
197
+ .behaviour {
198
+ margin: 0 10px 5px;
199
+ background: #fff;
200
+ }
193
201
 
194
- dd.spec.failed {
195
- border-left: 5px solid #C20000;
196
- border-bottom: 1px solid #C20000;
197
- color: #C20000; background: #FFFBD3;
198
- }
202
+ dl {
203
+ margin: 0; padding: 0 0 5px;
204
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
205
+ }
199
206
 
200
- div.backtrace {
201
- color: #000;
202
- font-size: 12px;
203
- }
207
+ dt {
208
+ padding: 3px;
209
+ background: #65C400;
210
+ color: #fff;
211
+ font-weight: bold;
212
+ }
204
213
 
205
- a {
206
- color: #BE5C00;
207
- }
214
+ dd {
215
+ margin: 5px 0 5px 5px;
216
+ padding: 3px 3px 3px 18px;
217
+ }
208
218
 
209
- /* Ruby code, style similar to vibrant ink */
210
- pre.ruby {
211
- font-size: 12px;
212
- font-family: monospace;
213
- color: white;
214
- background-color: black;
215
- padding: 0.1em 0 0.2em 0;
216
- }
219
+ dd.spec.passed {
220
+ border-left: 5px solid #65C400;
221
+ border-bottom: 1px solid #65C400;
222
+ background: #DBFFB4; color: #3D7700;
223
+ }
217
224
 
218
- pre.ruby .keyword { color: #FF6600; }
219
- pre.ruby .constant { color: #339999; }
220
- pre.ruby .attribute { color: white; }
221
- pre.ruby .global { color: white; }
222
- pre.ruby .module { color: white; }
223
- pre.ruby .class { color: white; }
224
- pre.ruby .string { color: #66FF00; }
225
- pre.ruby .ident { color: white; }
226
- pre.ruby .method { color: #FFCC00; }
227
- pre.ruby .number { color: white; }
228
- pre.ruby .char { color: white; }
229
- pre.ruby .comment { color: #9933CC; }
230
- pre.ruby .symbol { color: white; }
231
- pre.ruby .regex { color: #44B4CC; }
232
- pre.ruby .punct { color: white; }
233
- pre.ruby .escape { color: white; }
234
- pre.ruby .interp { color: white; }
235
- pre.ruby .expr { color: white; }
225
+ dd.spec.failed {
226
+ border-left: 5px solid #C20000;
227
+ border-bottom: 1px solid #C20000;
228
+ color: #C20000; background: #FFFBD3;
229
+ }
236
230
 
237
- pre.ruby .offending { background-color: gray; }
238
- pre.ruby .linenum {
239
- width: 75px;
240
- padding: 0.1em 1em 0.2em 0;
241
- color: #000000;
242
- background-color: #FFFBD3;
243
- }
244
- </style>
231
+ div.backtrace {
232
+ color: #000;
233
+ font-size: 12px;
234
+ }
245
235
 
246
- <div id="rspec-header">
247
- <h1>RSpec Results</h1>
236
+ a {
237
+ color: #BE5C00;
238
+ }
248
239
 
249
- <div id="summary">
250
- <p id="duration">&nbsp;</p>
251
- <p id="totals">&nbsp;</p>
252
- </div>
253
- </div>
240
+ /* Ruby code, style similar to vibrant ink */
241
+ pre.ruby {
242
+ font-size: 12px;
243
+ font-family: monospace;
244
+ color: white;
245
+ background-color: black;
246
+ padding: 0.1em 0 0.2em 0;
247
+ }
254
248
 
255
- <div class="results">
249
+ pre.ruby .keyword { color: #FF6600; }
250
+ pre.ruby .constant { color: #339999; }
251
+ pre.ruby .attribute { color: white; }
252
+ pre.ruby .global { color: white; }
253
+ pre.ruby .module { color: white; }
254
+ pre.ruby .class { color: white; }
255
+ pre.ruby .string { color: #66FF00; }
256
+ pre.ruby .ident { color: white; }
257
+ pre.ruby .method { color: #FFCC00; }
258
+ pre.ruby .number { color: white; }
259
+ pre.ruby .char { color: white; }
260
+ pre.ruby .comment { color: #9933CC; }
261
+ pre.ruby .symbol { color: white; }
262
+ pre.ruby .regex { color: #44B4CC; }
263
+ pre.ruby .punct { color: white; }
264
+ pre.ruby .escape { color: white; }
265
+ pre.ruby .interp { color: white; }
266
+ pre.ruby .expr { color: white; }
267
+
268
+ pre.ruby .offending { background-color: gray; }
269
+ pre.ruby .linenum {
270
+ width: 75px;
271
+ padding: 0.1em 1em 0.2em 0;
272
+ color: #000000;
273
+ background-color: #FFFBD3;
274
+ }
256
275
  EOF
276
+ end
257
277
  end
258
278
  end
259
279
  end
@@ -7,14 +7,17 @@ module Spec
7
7
 
8
8
  def example_failed(name, counter, failure)
9
9
  @output.print failure.expectation_not_met? ? red('F') : magenta('F')
10
+ @output.flush
10
11
  end
11
12
 
12
13
  def example_passed(name)
13
14
  @output.print green('.')
15
+ @output.flush
14
16
  end
15
17
 
16
18
  def start_dump
17
19
  @output.puts
20
+ @output.flush
18
21
  end
19
22
  end
20
23
  end
@@ -3,15 +3,16 @@ module Spec
3
3
  module Formatter
4
4
  class RdocFormatter < BaseTextFormatter
5
5
  def add_behaviour(name)
6
- @output.print "# #{name}\n"
6
+ @output.puts "# #{name}"
7
7
  end
8
8
 
9
9
  def example_passed(name)
10
- @output.print "# * #{name}\n"
10
+ @output.puts "# * #{name}"
11
+ @output.flush
11
12
  end
12
13
 
13
14
  def example_failed(name, counter, failure)
14
- @output.print "# * #{name} [#{counter} - FAILED]\n"
15
+ @output.puts "# * #{name} [#{counter} - FAILED]"
15
16
  end
16
17
  end
17
18
  end
@@ -5,14 +5,17 @@ module Spec
5
5
  def add_behaviour(name)
6
6
  @output.puts
7
7
  @output.puts name
8
+ @output.flush
8
9
  end
9
10
 
10
11
  def example_failed(name, counter, failure)
11
12
  @output.puts failure.expectation_not_met? ? red("- #{name} (FAILED - #{counter})") : magenta("- #{name} (ERROR - #{counter})")
13
+ @output.flush
12
14
  end
13
15
 
14
16
  def example_passed(name)
15
- @output.print green("- #{name}\n")
17
+ @output.puts green("- #{name}")
18
+ @output.flush
16
19
  end
17
20
  end
18
21
  end
@@ -11,12 +11,10 @@ module Spec
11
11
  def add_behaviour(name)
12
12
  @formatters.each{|f| f.add_behaviour(name)}
13
13
  @behaviour_names << name
14
- STDOUT.flush
15
14
  end
16
15
 
17
16
  def example_started(name)
18
17
  @formatters.each{|f| f.example_started(name)}
19
- STDOUT.flush
20
18
  end
21
19
 
22
20
  def example_finished(name, error=nil, failure_location=nil)
@@ -26,14 +24,12 @@ module Spec
26
24
  else
27
25
  example_failed(name, error, failure_location)
28
26
  end
29
- STDOUT.flush
30
27
  end
31
28
 
32
29
  def start(number_of_examples)
33
30
  clear!
34
31
  @start_time = Time.new
35
32
  @formatters.each{|f| f.start(number_of_examples)}
36
- STDOUT.flush
37
33
  end
38
34
 
39
35
  def end
@@ -45,7 +41,6 @@ module Spec
45
41
  @formatters.each{|f| f.start_dump}
46
42
  dump_failures
47
43
  @formatters.each{|f| f.dump_summary(duration, @example_names.length, @failures.length)}
48
- STDOUT.flush
49
44
  @failures.length
50
45
  end
51
46
 
@@ -65,7 +60,6 @@ module Spec
65
60
  @formatters.each{|f| f.dump_failure(index, failure)}
66
61
  index + 1
67
62
  end
68
- STDOUT.flush
69
63
  end
70
64
 
71
65
  def duration
@@ -75,7 +69,6 @@ module Spec
75
69
 
76
70
  def example_passed(name)
77
71
  @formatters.each{|f| f.example_passed(name)}
78
- STDOUT.flush
79
72
  end
80
73
 
81
74
  def example_failed(name, error, failure_location)
@@ -84,7 +77,6 @@ module Spec
84
77
  failure = Failure.new(example_name, error)
85
78
  @failures << failure
86
79
  @formatters.each{|f| f.example_failed(name, @failures.length, failure)}
87
- STDOUT.flush
88
80
  end
89
81
 
90
82
  class Failure
@@ -3,11 +3,11 @@ module Spec
3
3
  unless defined? MAJOR
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
- TINY = 3
6
+ TINY = 4
7
7
  RELEASE_CANDIDATE = nil
8
8
 
9
- # RANDOM_TOKEN: 0.289603753816874
10
- REV = "$LastChangedRevision: 1916 $".match(/LastChangedRevision: (\d+)/)[1]
9
+ # RANDOM_TOKEN: 0.310952573062985
10
+ REV = "$LastChangedRevision: 1935 $".match(/LastChangedRevision: (\d+)/)[1]
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY].join('.')
13
13
  TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
@@ -389,8 +389,7 @@ module Spec
389
389
  end
390
390
  end
391
391
 
392
- @behaviour.include mod1
393
- @behaviour.include mod2
392
+ @behaviour.include mod1, mod2
394
393
 
395
394
  @behaviour.it("test") do
396
395
  mod1_method
@@ -432,8 +431,7 @@ module Spec
432
431
  end
433
432
  end
434
433
 
435
- @behaviour.include mod1
436
- @behaviour.include mod2
434
+ @behaviour.include mod1, mod2
437
435
 
438
436
  @behaviour.mod1_method
439
437
  @behaviour.mod2_method
@@ -461,24 +459,34 @@ module Spec
461
459
  end
462
460
 
463
461
  it "should include any modules included using configuration" do
464
- mod = Module.new do
462
+ mod1 = Module.new do
465
463
  class << self
466
464
  def included(mod)
467
- $included_module = mod
465
+ $included_modules << self
466
+ end
467
+ end
468
+ end
469
+
470
+ mod2 = Module.new do
471
+ class << self
472
+ def included(mod)
473
+ $included_modules << self
468
474
  end
469
475
  end
470
476
  end
471
477
 
472
478
  begin
473
- $included_module = nil
474
- Spec::Runner.configuration.include(mod)
479
+ $included_modules = []
480
+ Spec::Runner.configuration.include(mod1, mod2)
475
481
 
476
482
  behaviour = Behaviour.new('example') do
477
483
  end.run(@reporter)
478
484
 
479
- $included_module.should_not be_nil
485
+ $included_modules.should include(mod1)
486
+ $included_modules.should include(mod2)
480
487
  ensure
481
- Spec::Runner.configuration.included_modules.delete(mod)
488
+ Spec::Runner.configuration.included_modules.delete(mod1)
489
+ Spec::Runner.configuration.included_modules.delete(mod2)
482
490
  end
483
491
  end
484
492
 
@@ -52,11 +52,11 @@ module Spec
52
52
  @behaviour.should_not be_shared
53
53
  end
54
54
 
55
- it "should not run when shared" do
55
+ it "should raise if run when shared" do
56
56
  behaviour = make_shared_behaviour("context", :shared => true) {}
57
57
  $spec_ran = false
58
58
  behaviour.it("test") {$spec_ran = true}
59
- behaviour.run(@formatter)
59
+ lambda { behaviour.run(@formatter) }.should raise_error
60
60
  $spec_ran.should be_false
61
61
  end
62
62
 
@@ -16,6 +16,18 @@ describe "should include(expected)" do
16
16
  end
17
17
  end
18
18
 
19
+ describe "should include(with, multiple, args)" do
20
+ it "should pass if target includes all items" do
21
+ [1,2,3].should include(1,2,3)
22
+ end
23
+
24
+ it "should fail if target does not include any one of the items" do
25
+ lambda {
26
+ [1,2,3].should include(1,2,4)
27
+ }.should fail_with("expected [1, 2, 3] to include 1, 2 and 4")
28
+ end
29
+ end
30
+
19
31
  describe "should_not include(expected)" do
20
32
  it "should pass if target does not include expected" do
21
33
  [1,2,3].should_not include(4)
@@ -9,6 +9,7 @@ module Spec
9
9
  desired_context.should_receive(:run)
10
10
  desired_context.should_receive(:retain_examples_matching!)
11
11
  desired_context.should_receive(:number_of_examples).twice.and_return(1)
12
+ desired_context.should_receive(:shared?).and_return(false)
12
13
 
13
14
  other_context = mock("other context")
14
15
  other_context.should_receive(:run).never
@@ -60,6 +61,7 @@ module Spec
60
61
  context = mock("context", :null_object => true)
61
62
  context.should_receive(:number_of_examples).twice.and_return(1)
62
63
  context.should_receive(:run).and_return(0)
64
+ context.should_receive(:shared?).and_return(false)
63
65
 
64
66
  reporter = mock("reporter")
65
67
  reporter.should_receive(:start).with(1)
@@ -91,9 +93,11 @@ module Spec
91
93
  runner = Spec::Runner::BehaviourRunner.new(options)
92
94
  c1 = mock("c1")
93
95
  c1.should_receive(:number_of_examples).twice.and_return(1)
96
+ c1.should_receive(:shared?).and_return(false)
94
97
 
95
98
  c2 = mock("c2")
96
99
  c2.should_receive(:number_of_examples).twice.and_return(2)
100
+ c2.should_receive(:shared?).and_return(false)
97
101
  c2.should_receive(:run) do
98
102
  c1.should_receive(:run)
99
103
  end
@@ -112,6 +112,11 @@ describe "OptionParser" do
112
112
  "Sir, if you were my husband, I would poison your drink.",
113
113
  "Madam, if you were my wife, I would drink it."])
114
114
  end
115
+
116
+ it "should read no examples if given an empty file" do
117
+ options = parse(["--example", File.dirname(__FILE__) + '/empty_file.txt'])
118
+ options.examples.should eql([])
119
+ end
115
120
 
116
121
  it "should use html formatter when format is h" do
117
122
  options = parse(["--format", "h"])
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.1
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rspec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.3
7
- date: 2007-05-06 00:00:00 +02:00
8
- summary: RSpec-0.9.3 (r1916) - BDD for Ruby http://rspec.rubyforge.org/
6
+ version: 0.9.4
7
+ date: 2007-05-10 00:00:00 +02:00
8
+ summary: RSpec-0.9.4 (r1935) - BDD for Ruby http://rspec.rubyforge.org/
9
9
  require_paths:
10
10
  - lib
11
11
  email: rspec-devel@rubyforge.org