mspec 1.5.10 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mspec/commands/mkspec.rb +1 -1
  3. data/lib/mspec/expectations/expectations.rb +4 -4
  4. data/lib/mspec/expectations/should.rb +4 -4
  5. data/lib/mspec/guards/endian.rb +5 -8
  6. data/lib/mspec/guards/guard.rb +1 -1
  7. data/lib/mspec/helpers/const_lookup.rb +2 -1
  8. data/lib/mspec/helpers/flunk.rb +1 -1
  9. data/lib/mspec/helpers/io.rb +2 -2
  10. data/lib/mspec/helpers/ruby_exe.rb +6 -3
  11. data/lib/mspec/matchers/base.rb +14 -14
  12. data/lib/mspec/matchers/be_an_instance_of.rb +26 -0
  13. data/lib/mspec/mocks/mock.rb +5 -5
  14. data/lib/mspec/runner/context.rb +1 -1
  15. data/lib/mspec/runner/exception.rb +3 -3
  16. data/lib/mspec/runner/formatters/dotted.rb +2 -2
  17. data/lib/mspec/utils/name_map.rb +2 -1
  18. data/lib/mspec/utils/options.rb +3 -1
  19. data/lib/mspec/utils/script.rb +3 -2
  20. data/lib/mspec/version.rb +1 -1
  21. data/spec/commands/mkspec_spec.rb +2 -1
  22. data/spec/expectations/expectations_spec.rb +10 -10
  23. data/spec/expectations/should.rb +71 -0
  24. data/spec/expectations/should_spec.rb +58 -126
  25. data/spec/guards/endian_spec.rb +6 -6
  26. data/spec/helpers/flunk_spec.rb +3 -3
  27. data/spec/matchers/base_spec.rb +99 -90
  28. data/spec/matchers/be_an_instance_of_spec.rb +50 -0
  29. data/spec/matchers/be_close_spec.rb +2 -2
  30. data/spec/matchers/be_kind_of_spec.rb +5 -3
  31. data/spec/matchers/equal_utf16_spec.rb +12 -2
  32. data/spec/matchers/respond_to_spec.rb +5 -3
  33. data/spec/mocks/mock_spec.rb +22 -21
  34. data/spec/runner/actions/tally_spec.rb +2 -2
  35. data/spec/runner/actions/timer_spec.rb +4 -4
  36. data/spec/runner/context_spec.rb +4 -4
  37. data/spec/runner/exception_spec.rb +10 -10
  38. data/spec/runner/formatters/dotted_spec.rb +6 -6
  39. data/spec/runner/formatters/file_spec.rb +3 -3
  40. data/spec/runner/formatters/html_spec.rb +3 -3
  41. data/spec/runner/formatters/method_spec.rb +2 -2
  42. data/spec/runner/formatters/specdoc_spec.rb +5 -5
  43. data/spec/runner/formatters/summary_spec.rb +1 -1
  44. data/spec/utils/options_spec.rb +10 -9
  45. data/spec/utils/script_spec.rb +7 -6
  46. metadata +5 -2
@@ -104,11 +104,11 @@ describe HtmlFormatter, "#exception" do
104
104
  end
105
105
 
106
106
  it "prints the #it string once for each exception raised" do
107
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
107
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
108
108
  @formatter.exception exc
109
109
  exc = ExceptionState.new @state, nil, MSpecExampleError.new("painful")
110
110
  @formatter.exception exc
111
- @out.should ==
111
+ @out.should ==
112
112
  %[<li class="fail">- it (<a href="#details-1">FAILED - 1</a>)</li>
113
113
  <li class="fail">- it (<a href="#details-2">ERROR - 2</a>)</li>
114
114
  ]
@@ -133,7 +133,7 @@ describe HtmlFormatter, "#after" do
133
133
  end
134
134
 
135
135
  it "does not print any output if an exception is raised" do
136
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
136
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
137
137
  @formatter.exception exc
138
138
  out = @out.dup
139
139
  @formatter.after @state
@@ -118,7 +118,7 @@ describe MethodFormatter, "#after" do
118
118
  state = ExampleState.new ContextState.new("Some#method"), "it"
119
119
  @formatter.before state
120
120
 
121
- exc = ExpectationNotMetError.new "failed"
121
+ exc = SpecExpectationNotMetError.new "failed"
122
122
  @formatter.exception ExceptionState.new(@state, nil, exc)
123
123
  @formatter.exception ExceptionState.new(@state, nil, exc)
124
124
 
@@ -152,7 +152,7 @@ describe MethodFormatter, "#after" do
152
152
  @formatter.tally.counter.failures = 2
153
153
  @formatter.tally.counter.errors = 1
154
154
 
155
- exc = ExpectationNotMetError.new "failed"
155
+ exc = SpecExpectationNotMetError.new "failed"
156
156
  @formatter.exception ExceptionState.new(@state, nil, exc)
157
157
  @formatter.exception ExceptionState.new(@state, nil, exc)
158
158
 
@@ -47,7 +47,7 @@ describe SpecdocFormatter, "#before" do
47
47
  end
48
48
 
49
49
  it "resets the #exception? flag" do
50
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
50
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
51
51
  @formatter.exception exc
52
52
  @formatter.exception?.should be_true
53
53
  @formatter.before @state
@@ -67,20 +67,20 @@ describe SpecdocFormatter, "#exception" do
67
67
  $stdout = STDOUT
68
68
  end
69
69
 
70
- it "prints 'ERROR' if an exception is not an ExpectationNotMetError" do
70
+ it "prints 'ERROR' if an exception is not an SpecExpectationNotMetError" do
71
71
  exc = ExceptionState.new @state, nil, MSpecExampleError.new("painful")
72
72
  @formatter.exception exc
73
73
  @out.should == " (ERROR - 1)"
74
74
  end
75
75
 
76
- it "prints 'FAILED' if an exception is an ExpectationNotMetError" do
77
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
76
+ it "prints 'FAILED' if an exception is an SpecExpectationNotMetError" do
77
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
78
78
  @formatter.exception exc
79
79
  @out.should == " (FAILED - 1)"
80
80
  end
81
81
 
82
82
  it "prints the #it string if an exception has already been raised" do
83
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
83
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
84
84
  @formatter.exception exc
85
85
  exc = ExceptionState.new @state, nil, MSpecExampleError.new("painful")
86
86
  @formatter.exception exc
@@ -16,7 +16,7 @@ describe SummaryFormatter, "#after" do
16
16
  end
17
17
 
18
18
  it "does not print anything" do
19
- exc = ExceptionState.new @state, nil, ExpectationNotMetError.new("disappointing")
19
+ exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
20
20
  @formatter.exception exc
21
21
  exc = ExceptionState.new @state, nil, MSpecExampleError.new("painful")
22
22
  @formatter.exception exc
@@ -236,48 +236,49 @@ end
236
236
  describe MSpecOptions, "#parse" do
237
237
  before :each do
238
238
  @opt = MSpecOptions.new
239
- @prc = lambda { |o| ScratchPad.record [:parsed, o] }
239
+ @prc = lambda { ScratchPad.record :parsed }
240
+ @arg_prc = lambda { |o| ScratchPad.record [:parsed, o] }
240
241
  ScratchPad.clear
241
242
  end
242
243
 
243
244
  it "parses a short option" do
244
245
  @opt.on "-a", "desc", &@prc
245
246
  @opt.parse ["-a"]
246
- ScratchPad.recorded.should == [:parsed, nil]
247
+ ScratchPad.recorded.should == :parsed
247
248
  end
248
249
 
249
250
  it "parse a long option" do
250
251
  @opt.on "--abdc", "desc", &@prc
251
252
  @opt.parse ["--abdc"]
252
- ScratchPad.recorded.should == [:parsed, nil]
253
+ ScratchPad.recorded.should == :parsed
253
254
  end
254
255
 
255
256
  it "parses a short option group" do
256
- @opt.on "-a", "ARG", "desc", &@prc
257
+ @opt.on "-a", "ARG", "desc", &@arg_prc
257
258
  @opt.parse ["-a", "ARG"]
258
259
  ScratchPad.recorded.should == [:parsed, "ARG"]
259
260
  end
260
261
 
261
262
  it "parses a short option with an argument" do
262
- @opt.on "-a", "ARG", "desc", &@prc
263
+ @opt.on "-a", "ARG", "desc", &@arg_prc
263
264
  @opt.parse ["-a", "ARG"]
264
265
  ScratchPad.recorded.should == [:parsed, "ARG"]
265
266
  end
266
267
 
267
268
  it "parses a short option with connected argument" do
268
- @opt.on "-a", "ARG", "desc", &@prc
269
+ @opt.on "-a", "ARG", "desc", &@arg_prc
269
270
  @opt.parse ["-aARG"]
270
271
  ScratchPad.recorded.should == [:parsed, "ARG"]
271
272
  end
272
273
 
273
274
  it "parses a long option with an argument" do
274
- @opt.on "--abdc", "ARG", "desc", &@prc
275
+ @opt.on "--abdc", "ARG", "desc", &@arg_prc
275
276
  @opt.parse ["--abdc", "ARG"]
276
277
  ScratchPad.recorded.should == [:parsed, "ARG"]
277
278
  end
278
279
 
279
280
  it "parses a long option with an '=' argument" do
280
- @opt.on "--abdc", "ARG", "desc", &@prc
281
+ @opt.on "--abdc", "ARG", "desc", &@arg_prc
281
282
  @opt.parse ["--abdc=ARG"]
282
283
  ScratchPad.recorded.should == [:parsed, "ARG"]
283
284
  end
@@ -300,7 +301,7 @@ describe MSpecOptions, "#parse" do
300
301
  end
301
302
 
302
303
  it "returns the unprocessed entries" do
303
- @opt.on "-a", "ARG", "desc", &@prc
304
+ @opt.on "-a", "ARG", "desc", &@arg_prc
304
305
  @opt.parse(["abdc", "-a", "ilny"]).should == ["abdc"]
305
306
  end
306
307
 
@@ -356,13 +356,14 @@ describe MSpecScript, "#entries" do
356
356
  end
357
357
 
358
358
  it "returns the pattern in an array if it is a file" do
359
- File.should_receive(:expand_path).with("file").and_return("file")
360
- File.should_receive(:file?).with("file").and_return(true)
361
- @script.entries("file").should == ["file"]
359
+ File.should_receive(:expand_path).with("file").and_return("file/expanded")
360
+ File.should_receive(:file?).with("file/expanded").and_return(true)
361
+ @script.entries("file").should == ["file/expanded"]
362
362
  end
363
363
 
364
364
  it "returns Dir['pattern/**/*_spec.rb'] if pattern is a directory" do
365
365
  File.should_receive(:directory?).with("name").and_return(true)
366
+ File.stub!(:expand_path).and_return("name","name/**/*_spec.rb")
366
367
  Dir.should_receive(:[]).with("name/**/*_spec.rb").and_return(["dir1", "dir2"])
367
368
  @script.entries("name").should == ["dir1", "dir2"]
368
369
  end
@@ -386,7 +387,7 @@ describe MSpecScript, "#entries" do
386
387
  end
387
388
 
388
389
  it "returns Dir['pattern/**/*_spec.rb'] if pattern is a directory" do
389
- File.should_receive(:expand_path).with(@name).and_return(@name)
390
+ File.stub!(:expand_path).and_return(@name, @name+"/**/*_spec.rb")
390
391
  File.should_receive(:directory?).with(@name).and_return(true)
391
392
  Dir.should_receive(:[]).with(@name + "/**/*_spec.rb").and_return(["dir1", "dir2"])
392
393
  @script.entries("name").should == ["dir1", "dir2"]
@@ -433,10 +434,10 @@ describe MSpecScript, "#files" do
433
434
 
434
435
  it "looks up items with leading ':' in the config object" do
435
436
  @script.should_receive(:entries).and_return(["file1"], ["file2"])
436
- @script.files(":files").should == ["file1", "file2"]
437
+ @script.files([":files"]).should == ["file1", "file2"]
437
438
  end
438
439
 
439
440
  it "returns an empty list if the config key is not set" do
440
- @script.files(":all_files").should == []
441
+ @script.files([":all_files"]).should == []
441
442
  end
442
443
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Ford
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-01 00:00:00 -08:00
12
+ date: 2009-03-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -64,6 +64,7 @@ files:
64
64
  - lib/mspec/helpers/tmp.rb
65
65
  - lib/mspec/helpers.rb
66
66
  - lib/mspec/matchers/base.rb
67
+ - lib/mspec/matchers/be_an_instance_of.rb
67
68
  - lib/mspec/matchers/be_ancestor_of.rb
68
69
  - lib/mspec/matchers/be_close.rb
69
70
  - lib/mspec/matchers/be_empty.rb
@@ -147,6 +148,7 @@ files:
147
148
  - spec/commands/mspec_spec.rb
148
149
  - spec/commands/mspec_tag_spec.rb
149
150
  - spec/expectations/expectations_spec.rb
151
+ - spec/expectations/should.rb
150
152
  - spec/expectations/should_spec.rb
151
153
  - spec/guards/background_spec.rb
152
154
  - spec/guards/bug_spec.rb
@@ -175,6 +177,7 @@ files:
175
177
  - spec/helpers/scratch_spec.rb
176
178
  - spec/helpers/tmp_spec.rb
177
179
  - spec/matchers/base_spec.rb
180
+ - spec/matchers/be_an_instance_of_spec.rb
178
181
  - spec/matchers/be_ancestor_of_spec.rb
179
182
  - spec/matchers/be_close_spec.rb
180
183
  - spec/matchers/be_empty_spec.rb