mspec 1.5.9 → 1.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/Rakefile +1 -1
  2. data/lib/mspec/commands/mspec-ci.rb +5 -1
  3. data/lib/mspec/commands/mspec-run.rb +8 -5
  4. data/lib/mspec/guards/background.rb +2 -0
  5. data/lib/mspec/guards/bug.rb +5 -1
  6. data/lib/mspec/guards/compliance.rb +10 -0
  7. data/lib/mspec/guards/conflict.rb +2 -0
  8. data/lib/mspec/guards/endian.rb +4 -0
  9. data/lib/mspec/guards/extensions.rb +2 -0
  10. data/lib/mspec/guards/guard.rb +49 -25
  11. data/lib/mspec/guards/noncompliance.rb +2 -0
  12. data/lib/mspec/guards/platform.rb +5 -0
  13. data/lib/mspec/guards/quarantine.rb +2 -0
  14. data/lib/mspec/guards/runner.rb +4 -0
  15. data/lib/mspec/guards/superuser.rb +2 -0
  16. data/lib/mspec/guards/support.rb +2 -0
  17. data/lib/mspec/guards/tty.rb +2 -0
  18. data/lib/mspec/guards/version.rb +3 -0
  19. data/lib/mspec/matchers.rb +1 -0
  20. data/lib/mspec/matchers/have_constant.rb +30 -0
  21. data/lib/mspec/matchers/method.rb +4 -3
  22. data/lib/mspec/matchers/stringsymboladapter.rb +8 -0
  23. data/lib/mspec/runner/actions/tally.rb +13 -3
  24. data/lib/mspec/runner/context.rb +8 -1
  25. data/lib/mspec/runner/mspec.rb +16 -0
  26. data/lib/mspec/utils/options.rb +10 -3
  27. data/lib/mspec/version.rb +1 -1
  28. data/spec/guards/background_spec.rb +15 -0
  29. data/spec/guards/bug_spec.rb +28 -10
  30. data/spec/guards/compliance_spec.rb +54 -0
  31. data/spec/guards/conflict_spec.rb +19 -0
  32. data/spec/guards/endian_spec.rb +26 -0
  33. data/spec/guards/extensions_spec.rb +20 -0
  34. data/spec/guards/guard_spec.rb +69 -52
  35. data/spec/guards/noncompliance_spec.rb +20 -0
  36. data/spec/guards/platform_spec.rb +26 -0
  37. data/spec/guards/quarantine_spec.rb +16 -0
  38. data/spec/guards/runner_spec.rb +26 -0
  39. data/spec/guards/superuser_spec.rb +13 -0
  40. data/spec/guards/support_spec.rb +20 -0
  41. data/spec/guards/tty_spec.rb +16 -0
  42. data/spec/guards/version_spec.rb +13 -0
  43. data/spec/matchers/have_constant_spec.rb +37 -0
  44. data/spec/matchers/stringsymboladapter_spec.rb +40 -0
  45. data/spec/runner/actions/tagpurge_spec.rb +1 -0
  46. data/spec/runner/actions/tally_spec.rb +64 -0
  47. data/spec/runner/context_spec.rb +24 -11
  48. data/spec/runner/formatters/html_spec.rb +1 -0
  49. data/spec/runner/mspec_spec.rb +31 -0
  50. data/spec/utils/options_spec.rb +59 -0
  51. metadata +6 -3
  52. data/spec/matchers/method_spec.rb +0 -36
@@ -1,4 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'mspec/utils/ruby_name'
2
3
  require 'mspec/guards/guard'
3
4
  require 'mspec/runner/formatters/html'
4
5
  require 'mspec/runner/mspec'
@@ -228,6 +228,37 @@ describe MSpec, ".clear_modes" do
228
228
  end
229
229
  end
230
230
 
231
+ describe MSpec, ".guarded?" do
232
+ before :each do
233
+ MSpec.instance_variable_set :@guarded, []
234
+ end
235
+
236
+ it "returns false if no guard has run" do
237
+ MSpec.guarded?.should == false
238
+ end
239
+
240
+ it "returns true if a single guard has run" do
241
+ MSpec.guard
242
+ MSpec.guarded?.should == true
243
+ end
244
+
245
+ it "returns true if more than one guard has run" do
246
+ MSpec.guard
247
+ MSpec.guard
248
+ MSpec.guarded?.should == true
249
+ end
250
+
251
+ it "returns true until all guards have finished" do
252
+ MSpec.guard
253
+ MSpec.guard
254
+ MSpec.guarded?.should == true
255
+ MSpec.unguard
256
+ MSpec.guarded?.should == true
257
+ MSpec.unguard
258
+ MSpec.guarded?.should == false
259
+ end
260
+ end
261
+
231
262
  describe MSpec, ".describe" do
232
263
  before :each do
233
264
  MSpec.clear_current
@@ -1,6 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
  require 'mspec/utils/options'
3
3
  require 'mspec/version'
4
+ require 'mspec/guards/guard'
4
5
  require 'mspec/runner/mspec'
5
6
  require 'mspec/runner/formatters'
6
7
 
@@ -1014,6 +1015,7 @@ describe "The --unguarded option" do
1014
1015
  end
1015
1016
 
1016
1017
  it "is enabled with #unguarded" do
1018
+ @options.stub!(:on)
1017
1019
  @options.should_receive(:on).with("--unguarded", an_instance_of(String))
1018
1020
  @options.unguarded
1019
1021
  end
@@ -1024,6 +1026,24 @@ describe "The --unguarded option" do
1024
1026
  end
1025
1027
  end
1026
1028
 
1029
+ describe "The --no-ruby_guard option" do
1030
+ before :each do
1031
+ @options, @config = new_option
1032
+ @options.unguarded
1033
+ end
1034
+
1035
+ it "is enabled with #unguarded" do
1036
+ @options.stub!(:on)
1037
+ @options.should_receive(:on).with("--no-ruby_bug", an_instance_of(String))
1038
+ @options.unguarded
1039
+ end
1040
+
1041
+ it "registers the MSpec no_ruby_bug mode" do
1042
+ MSpec.should_receive(:register_mode).with(:no_ruby_bug)
1043
+ @options.parse "--no-ruby_bug"
1044
+ end
1045
+ end
1046
+
1027
1047
  describe "The -H, --random option" do
1028
1048
  before :each do
1029
1049
  @options, @config = new_option
@@ -1143,6 +1163,45 @@ describe "The -O, --report option" do
1143
1163
  end
1144
1164
  end
1145
1165
 
1166
+ describe "The --report-on GUARD option" do
1167
+ before :all do
1168
+ MSpec.stub!(:register_mode)
1169
+ end
1170
+
1171
+ before :each do
1172
+ @options, @config = new_option
1173
+ @options.verify
1174
+
1175
+ SpecGuard.clear_guards
1176
+ end
1177
+
1178
+ after :each do
1179
+ SpecGuard.clear_guards
1180
+ end
1181
+
1182
+ it "is enabled with #interrupt" do
1183
+ @options.stub!(:on)
1184
+ @options.should_receive(:on).with("--report-on", "GUARD", an_instance_of(String))
1185
+ @options.verify
1186
+ end
1187
+
1188
+ it "sets the MSpec mode to :report_on" do
1189
+ MSpec.should_receive(:register_mode).with(:report_on)
1190
+ @options.parse ["--report-on", "ruby_bug"]
1191
+ end
1192
+
1193
+ it "converts the guard name to a symbol" do
1194
+ name = mock("ruby_bug")
1195
+ name.should_receive(:to_sym)
1196
+ @options.parse ["--report-on", name]
1197
+ end
1198
+
1199
+ it "saves the name of the guard" do
1200
+ @options.parse ["--report-on", "ruby_bug"]
1201
+ SpecGuard.guards.should == [:ruby_bug]
1202
+ end
1203
+ end
1204
+
1146
1205
  describe "The -K, --action-tag TAG option" do
1147
1206
  before :each do
1148
1207
  @options, @config = new_option
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.9
4
+ version: 1.5.10
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-02-10 00:00:00 -08:00
12
+ date: 2009-03-01 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -76,6 +76,7 @@ files:
76
76
  - lib/mspec/matchers/equal.rb
77
77
  - lib/mspec/matchers/equal_element.rb
78
78
  - lib/mspec/matchers/equal_utf16.rb
79
+ - lib/mspec/matchers/have_constant.rb
79
80
  - lib/mspec/matchers/have_instance_method.rb
80
81
  - lib/mspec/matchers/have_method.rb
81
82
  - lib/mspec/matchers/have_private_instance_method.rb
@@ -86,6 +87,7 @@ files:
86
87
  - lib/mspec/matchers/output_to_fd.rb
87
88
  - lib/mspec/matchers/raise_error.rb
88
89
  - lib/mspec/matchers/respond_to.rb
90
+ - lib/mspec/matchers/stringsymboladapter.rb
89
91
  - lib/mspec/matchers.rb
90
92
  - lib/mspec/mocks/mock.rb
91
93
  - lib/mspec/mocks/object.rb
@@ -185,16 +187,17 @@ files:
185
187
  - spec/matchers/equal_element_spec.rb
186
188
  - spec/matchers/equal_spec.rb
187
189
  - spec/matchers/equal_utf16_spec.rb
190
+ - spec/matchers/have_constant_spec.rb
188
191
  - spec/matchers/have_instance_method_spec.rb
189
192
  - spec/matchers/have_method_spec.rb
190
193
  - spec/matchers/have_private_instance_method_spec.rb
191
194
  - spec/matchers/include_spec.rb
192
195
  - spec/matchers/match_yaml_spec.rb
193
- - spec/matchers/method_spec.rb
194
196
  - spec/matchers/output_spec.rb
195
197
  - spec/matchers/output_to_fd_spec.rb
196
198
  - spec/matchers/raise_error_spec.rb
197
199
  - spec/matchers/respond_to_spec.rb
200
+ - spec/matchers/stringsymboladapter_spec.rb
198
201
  - spec/mocks/mock_spec.rb
199
202
  - spec/mocks/proxy_spec.rb
200
203
  - spec/runner/actions/debug_spec.rb
@@ -1,36 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'mspec/expectations/expectations'
3
- require 'mspec/matchers/have_instance_method'
4
-
5
- describe MethodMatcher do
6
- before :all do
7
- @verbose = $VERBOSE
8
- $VERBOSE = nil
9
- end
10
-
11
- after :all do
12
- $VERBOSE = @verbose
13
- end
14
-
15
- before :each do
16
- @ruby_version = Object.const_get :RUBY_VERSION
17
-
18
- @method = mock("method name")
19
- end
20
-
21
- after :each do
22
- Object.const_set :RUBY_VERSION, @ruby_version
23
- end
24
-
25
- it "converts the method name to a string if RUBY_VERSION < 1.9" do
26
- Object.const_set :RUBY_VERSION, "1.8.6"
27
- @method.should_receive(:to_s).and_return("method_name")
28
- MethodMatcher.new @method
29
- end
30
-
31
- it "does not convert the method name to a string if RUBY_VERSION >= 1.9" do
32
- Object.const_set :RUBY_VERSION, "1.9.0"
33
- @method.should_not_receive(:to_s)
34
- MethodMatcher.new @method
35
- end
36
- end