mspec 1.5.17 → 1.5.18
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.
- data/.gitignore +27 -0
- data/Gemfile +4 -0
- data/README +39 -159
- data/Rakefile +4 -44
- data/bin/mkspec.bat +1 -0
- data/bin/mspec-ci.bat +1 -0
- data/bin/mspec-run.bat +1 -0
- data/bin/mspec-tag.bat +1 -0
- data/bin/mspec.bat +1 -0
- data/lib/mspec/commands/mkspec.rb +2 -2
- data/lib/mspec/commands/mspec-run.rb +4 -0
- data/lib/mspec/commands/mspec.rb +18 -3
- data/lib/mspec/guards.rb +1 -0
- data/lib/mspec/guards/block_device.rb +22 -0
- data/lib/mspec/guards/guard.rb +14 -2
- data/lib/mspec/helpers.rb +5 -5
- data/lib/mspec/helpers/const_lookup.rb +6 -1
- data/lib/mspec/helpers/datetime.rb +28 -0
- data/lib/mspec/helpers/ducktype.rb +4 -4
- data/lib/mspec/helpers/environment.rb +19 -2
- data/lib/mspec/helpers/fs.rb +5 -1
- data/lib/mspec/helpers/io.rb +39 -1
- data/lib/mspec/helpers/numeric.rb +89 -0
- data/lib/mspec/helpers/pack.rb +3 -0
- data/lib/mspec/helpers/ruby_exe.rb +53 -15
- data/lib/mspec/helpers/singleton_class.rb +7 -0
- data/lib/mspec/helpers/stasy.rb +33 -0
- data/lib/mspec/helpers/tmp.rb +16 -3
- data/lib/mspec/matchers.rb +8 -0
- data/lib/mspec/matchers/be_computed_by.rb +37 -0
- data/lib/mspec/matchers/be_computed_by_function.rb +35 -0
- data/lib/mspec/matchers/be_nan.rb +20 -0
- data/lib/mspec/matchers/be_valid_dns_name.rb +25 -0
- data/lib/mspec/matchers/have_data.rb +6 -5
- data/lib/mspec/matchers/have_private_method.rb +24 -0
- data/lib/mspec/matchers/have_singleton_method.rb +24 -0
- data/lib/mspec/matchers/infinity.rb +28 -0
- data/lib/mspec/matchers/match_yaml.rb +5 -5
- data/lib/mspec/matchers/raise_error.rb +5 -3
- data/lib/mspec/matchers/signed_zero.rb +28 -0
- data/lib/mspec/mocks/mock.rb +15 -9
- data/lib/mspec/mocks/object.rb +4 -0
- data/lib/mspec/mocks/proxy.rb +26 -1
- data/lib/mspec/runner/actions.rb +0 -1
- data/lib/mspec/runner/context.rb +18 -16
- data/lib/mspec/runner/formatters.rb +2 -0
- data/lib/mspec/runner/formatters/dotted.rb +13 -1
- data/lib/mspec/runner/formatters/junit.rb +96 -0
- data/lib/mspec/runner/formatters/profile.rb +70 -0
- data/lib/mspec/runner/mspec.rb +11 -0
- data/lib/mspec/runner/shared.rb +1 -1
- data/lib/mspec/utils/options.rb +33 -9
- data/lib/mspec/utils/ruby_name.rb +1 -1
- data/lib/mspec/utils/script.rb +2 -1
- data/lib/mspec/version.rb +1 -1
- data/mspec.gemspec +40 -0
- data/spec/commands/mkspec_spec.rb +4 -3
- data/spec/commands/mspec_ci_spec.rb +1 -6
- data/spec/commands/mspec_run_spec.rb +1 -6
- data/spec/commands/mspec_spec.rb +14 -6
- data/spec/commands/mspec_tag_spec.rb +28 -27
- data/spec/expectations/expectations_spec.rb +1 -1
- data/spec/expectations/should_spec.rb +4 -4
- data/spec/guards/background_spec.rb +2 -2
- data/spec/guards/block_device_spec.rb +46 -0
- data/spec/guards/bug_spec.rb +2 -3
- data/spec/guards/compliance_spec.rb +2 -2
- data/spec/guards/conflict_spec.rb +2 -2
- data/spec/guards/endian_spec.rb +2 -2
- data/spec/guards/extensions_spec.rb +2 -2
- data/spec/guards/feature_spec.rb +2 -2
- data/spec/guards/guard_spec.rb +80 -22
- data/spec/guards/noncompliance_spec.rb +2 -2
- data/spec/guards/platform_spec.rb +2 -2
- data/spec/guards/quarantine_spec.rb +2 -2
- data/spec/guards/runner_spec.rb +2 -2
- data/spec/guards/specified_spec.rb +2 -2
- data/spec/guards/superuser_spec.rb +2 -2
- data/spec/guards/support_spec.rb +2 -2
- data/spec/guards/tty_spec.rb +2 -2
- data/spec/guards/user_spec.rb +2 -2
- data/spec/guards/version_spec.rb +2 -2
- data/spec/helpers/argv_spec.rb +3 -2
- data/spec/helpers/const_lookup_spec.rb +3 -2
- data/spec/helpers/datetime_spec.rb +44 -0
- data/spec/helpers/ducktype_spec.rb +3 -2
- data/spec/helpers/encode_spec.rb +3 -2
- data/spec/helpers/enumerator_class_spec.rb +5 -5
- data/spec/helpers/environment_spec.rb +15 -3
- data/spec/helpers/fixture_spec.rb +3 -2
- data/spec/helpers/flunk_spec.rb +4 -3
- data/spec/helpers/fs_spec.rb +35 -18
- data/spec/helpers/hash_spec.rb +3 -2
- data/spec/helpers/io_spec.rb +75 -6
- data/spec/helpers/language_version_spec.rb +3 -2
- data/spec/helpers/mock_to_path_spec.rb +3 -2
- data/spec/helpers/numeric_spec.rb +25 -0
- data/spec/helpers/ruby_exe_spec.rb +115 -29
- data/spec/helpers/scratch_spec.rb +3 -1
- data/spec/helpers/stasy_spec.rb +59 -0
- data/spec/helpers/tmp_spec.rb +21 -4
- data/spec/matchers/base_spec.rb +2 -2
- data/spec/matchers/be_an_instance_of_spec.rb +2 -2
- data/spec/matchers/be_ancestor_of_spec.rb +2 -2
- data/spec/matchers/be_close_spec.rb +2 -2
- data/spec/matchers/be_computed_by_function_spec.rb +36 -0
- data/spec/matchers/be_computed_by_spec.rb +42 -0
- data/spec/matchers/be_empty_spec.rb +2 -2
- data/spec/matchers/be_false_spec.rb +3 -3
- data/spec/matchers/be_kind_of_spec.rb +2 -2
- data/spec/matchers/be_nan_spec.rb +28 -0
- data/spec/matchers/be_nil_spec.rb +3 -3
- data/spec/matchers/be_true_spec.rb +3 -3
- data/spec/matchers/be_valid_dns_name_spec.rb +50 -0
- data/spec/matchers/complain_spec.rb +2 -2
- data/spec/matchers/eql_spec.rb +2 -2
- data/spec/matchers/equal_element_spec.rb +2 -2
- data/spec/matchers/equal_spec.rb +2 -2
- data/spec/matchers/equal_utf16_spec.rb +2 -2
- data/spec/matchers/have_class_variable_spec.rb +3 -3
- data/spec/matchers/have_constant_spec.rb +2 -2
- data/spec/matchers/have_data_spec.rb +8 -5
- data/spec/matchers/have_instance_method_spec.rb +2 -2
- data/spec/matchers/have_instance_variable_spec.rb +3 -3
- data/spec/matchers/have_method_spec.rb +2 -2
- data/spec/matchers/have_private_instance_method_spec.rb +3 -3
- data/spec/matchers/have_private_method_spec.rb +44 -0
- data/spec/matchers/have_protected_instance_method_spec.rb +2 -2
- data/spec/matchers/have_public_instance_method_spec.rb +2 -2
- data/spec/matchers/have_singleton_method_spec.rb +45 -0
- data/spec/matchers/include_spec.rb +2 -2
- data/spec/matchers/infinity_spec.rb +34 -0
- data/spec/matchers/match_yaml_spec.rb +3 -3
- data/spec/matchers/output_spec.rb +2 -2
- data/spec/matchers/output_to_fd_spec.rb +2 -2
- data/spec/matchers/raise_error_spec.rb +24 -3
- data/spec/matchers/respond_to_spec.rb +2 -2
- data/spec/matchers/signed_zero_spec.rb +32 -0
- data/spec/matchers/stringsymboladapter_spec.rb +2 -2
- data/spec/mocks/mock_spec.rb +12 -12
- data/spec/mocks/proxy_spec.rb +1 -1
- data/spec/runner/actions/gdb_spec.rb +1 -1
- data/spec/runner/actions/tag_spec.rb +1 -1
- data/spec/runner/actions/taglist_spec.rb +1 -1
- data/spec/runner/context_spec.rb +27 -27
- data/spec/runner/example_spec.rb +1 -1
- data/spec/runner/exception_spec.rb +1 -1
- data/spec/runner/filters/tag_spec.rb +2 -2
- data/spec/runner/formatters/describe_spec.rb +1 -1
- data/spec/runner/formatters/dotted_spec.rb +2 -2
- data/spec/runner/formatters/html_spec.rb +2 -2
- data/spec/runner/formatters/junit_spec.rb +147 -0
- data/spec/runner/formatters/unit_spec.rb +2 -2
- data/spec/runner/formatters/yaml_spec.rb +3 -3
- data/spec/runner/mspec_spec.rb +22 -21
- data/spec/runner/shared_spec.rb +9 -1
- data/spec/runner/tag_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -7
- data/spec/utils/name_map_spec.rb +1 -2
- data/spec/utils/options_spec.rb +58 -27
- data/spec/utils/script_spec.rb +5 -13
- data/spec/utils/version_spec.rb +1 -1
- metadata +254 -64
- data/lib/mspec/helpers/bignum.rb +0 -5
- data/lib/mspec/helpers/fmode.rb +0 -15
- data/lib/mspec/helpers/infinity.rb +0 -5
- data/lib/mspec/helpers/metaclass.rb +0 -7
- data/lib/mspec/helpers/nan.rb +0 -5
- data/lib/mspec/runner/actions/debug.rb +0 -17
- data/spec/helpers/bignum_spec.rb +0 -11
- data/spec/helpers/fmode_spec.rb +0 -14
- data/spec/helpers/infinity_spec.rb +0 -8
- data/spec/helpers/nan_spec.rb +0 -8
- data/spec/runner/actions/debug_spec.rb +0 -62
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
describe MatchYAMLMatcher do
|
|
6
6
|
before :each do
|
|
@@ -13,7 +13,7 @@ describe MatchYAMLMatcher do
|
|
|
13
13
|
|
|
14
14
|
it "compares YAML documents and does not match if they're not equivalent" do
|
|
15
15
|
@matcher.matches?("--- \nbar: foo\n").should == false
|
|
16
|
-
@matcher.matches?("--- \nfoo: \nbar\n").should == false
|
|
16
|
+
@matcher.matches?("--- \nfoo: \nbar\n").should == false
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it "also receives objects that respond_to to_yaml" do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
describe OutputMatcher do
|
|
6
6
|
it "matches when executing the proc results in the expected output to $stdout" do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
describe OutputToFDMatcher do
|
|
6
6
|
# Figure out how in the hell to achieve this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
class ExpectedException < Exception; end
|
|
6
6
|
class UnexpectedException < Exception; end
|
|
@@ -34,7 +34,12 @@ describe RaiseErrorMatcher do
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "does not match when the proc raises the expected exception with an unexpected message" do
|
|
37
|
-
proc = Proc.new { raise
|
|
37
|
+
proc = Proc.new { raise ExpectedException, "unexpected" }
|
|
38
|
+
RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "does not match when the proc does not raise an exception" do
|
|
42
|
+
proc = Proc.new {}
|
|
38
43
|
RaiseErrorMatcher.new(ExpectedException, "expected").matches?(proc).should == false
|
|
39
44
|
end
|
|
40
45
|
|
|
@@ -46,6 +51,14 @@ describe RaiseErrorMatcher do
|
|
|
46
51
|
["Expected ExpectedException (expected)", "but got UnexpectedException (unexpected)"]
|
|
47
52
|
end
|
|
48
53
|
|
|
54
|
+
it "provides a useful failure message when no exception is raised" do
|
|
55
|
+
proc = Proc.new { 120 }
|
|
56
|
+
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
|
|
57
|
+
matcher.matches?(proc)
|
|
58
|
+
matcher.failure_message.should ==
|
|
59
|
+
["Expected ExpectedException (expected)", "but no exception was raised (120 was returned)"]
|
|
60
|
+
end
|
|
61
|
+
|
|
49
62
|
it "provides a useful negative failure message" do
|
|
50
63
|
proc = Proc.new { raise ExpectedException, "expected" }
|
|
51
64
|
matcher = RaiseErrorMatcher.new(ExpectedException, "expected")
|
|
@@ -53,4 +66,12 @@ describe RaiseErrorMatcher do
|
|
|
53
66
|
matcher.negative_failure_message.should ==
|
|
54
67
|
["Expected to not get ExpectedException (expected)", ""]
|
|
55
68
|
end
|
|
69
|
+
|
|
70
|
+
it "provides a useful negative failure message for strict subclasses of the matched exception class" do
|
|
71
|
+
proc = Proc.new { raise UnexpectedException, "unexpected" }
|
|
72
|
+
matcher = RaiseErrorMatcher.new(Exception, nil)
|
|
73
|
+
matcher.matches?(proc)
|
|
74
|
+
matcher.negative_failure_message.should ==
|
|
75
|
+
["Expected to not get Exception", "but got UnexpectedException (unexpected)"]
|
|
76
|
+
end
|
|
56
77
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
describe RespondToMatcher do
|
|
6
6
|
it "matches when actual does respond_to? expected" do
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'mspec/expectations/expectations'
|
|
3
|
+
require 'mspec/matchers'
|
|
4
|
+
|
|
5
|
+
describe SignedZeroMatcher do
|
|
6
|
+
it "matches when actual is zero and has the correct sign" do
|
|
7
|
+
SignedZeroMatcher.new(1).matches?(0.0).should == true
|
|
8
|
+
SignedZeroMatcher.new(-1).matches?(-0.0).should == true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "does not match when actual is non-zero" do
|
|
12
|
+
SignedZeroMatcher.new(1).matches?(1.0).should == false
|
|
13
|
+
SignedZeroMatcher.new(-1).matches?(-1.0).should == false
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "does not match when actual is zero but has the incorrect sign" do
|
|
17
|
+
SignedZeroMatcher.new(1).matches?(-0.0).should == false
|
|
18
|
+
SignedZeroMatcher.new(-1).matches?(0.0).should == false
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "provides a useful failure message" do
|
|
22
|
+
matcher = SignedZeroMatcher.new(-1)
|
|
23
|
+
matcher.matches?(0.0)
|
|
24
|
+
matcher.failure_message.should == ["Expected 0.0", "to be -0.0"]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "provides a useful negative failure message" do
|
|
28
|
+
matcher = SignedZeroMatcher.new(-1)
|
|
29
|
+
matcher.matches?(-0.0)
|
|
30
|
+
matcher.negative_failure_message.should == ["Expected -0.0", "not to be -0.0"]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
|
-
require 'mspec/matchers
|
|
3
|
+
require 'mspec/matchers'
|
|
4
4
|
|
|
5
5
|
describe StringSymbolAdapter, "#convert_name" do
|
|
6
6
|
include StringSymbolAdapter
|
data/spec/mocks/mock_spec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# opposites are true (for example a failure when the specified
|
|
3
3
|
# arguments are NOT provided) is to simply alter the particular
|
|
4
4
|
# spec to a failure condition.
|
|
5
|
-
require
|
|
5
|
+
require 'spec_helper'
|
|
6
6
|
require 'mspec/runner/mspec'
|
|
7
7
|
require 'mspec/mocks/mock'
|
|
8
8
|
require 'mspec/mocks/proxy'
|
|
@@ -39,7 +39,7 @@ describe Mock, ".replaced?" do
|
|
|
39
39
|
before :each do
|
|
40
40
|
@mock = mock('install_method')
|
|
41
41
|
MSpec.stub!(:actions)
|
|
42
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
42
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it "returns true if a method has been stubbed on an object" do
|
|
@@ -72,7 +72,7 @@ describe Mock, ".install_method for mocks" do
|
|
|
72
72
|
before :each do
|
|
73
73
|
@mock = mock('install_method')
|
|
74
74
|
MSpec.stub!(:actions)
|
|
75
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
75
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
after :each do
|
|
@@ -123,7 +123,7 @@ describe Mock, ".install_method for mocks" do
|
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
it "adds to the expectation tally" do
|
|
126
|
-
state = mock("run state"
|
|
126
|
+
state = mock("run state").as_null_object
|
|
127
127
|
state.stub!(:state).and_return(mock("spec state"))
|
|
128
128
|
MSpec.should_receive(:current).and_return(state)
|
|
129
129
|
MSpec.should_receive(:actions).with(:expectation, state.state)
|
|
@@ -132,7 +132,7 @@ describe Mock, ".install_method for mocks" do
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
it "registers that an expectation has been encountered" do
|
|
135
|
-
state = mock("run state"
|
|
135
|
+
state = mock("run state").as_null_object
|
|
136
136
|
state.stub!(:state).and_return(mock("spec state"))
|
|
137
137
|
MSpec.should_receive(:expectation)
|
|
138
138
|
Mock.install_method(@mock, :method_call).and_return(1)
|
|
@@ -144,7 +144,7 @@ describe Mock, ".install_method for stubs" do
|
|
|
144
144
|
before :each do
|
|
145
145
|
@mock = mock('install_method')
|
|
146
146
|
MSpec.stub!(:actions)
|
|
147
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
147
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
after :each do
|
|
@@ -175,7 +175,7 @@ describe Mock, ".install_method for stubs" do
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
it "does not add to the expectation tally" do
|
|
178
|
-
state = mock("run state"
|
|
178
|
+
state = mock("run state").as_null_object
|
|
179
179
|
state.stub!(:state).and_return(mock("spec state"))
|
|
180
180
|
MSpec.should_not_receive(:actions)
|
|
181
181
|
Mock.install_method(@mock, :method_call, :stub).and_return(1)
|
|
@@ -187,7 +187,7 @@ describe Mock, ".install_method" do
|
|
|
187
187
|
before :each do
|
|
188
188
|
@mock = mock('install_method')
|
|
189
189
|
MSpec.stub!(:actions)
|
|
190
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
190
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
after :each do
|
|
@@ -212,7 +212,7 @@ class MockAndRaiseError < Exception; end
|
|
|
212
212
|
describe Mock, ".verify_call" do
|
|
213
213
|
before :each do
|
|
214
214
|
MSpec.stub!(:actions)
|
|
215
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
215
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
216
216
|
|
|
217
217
|
@mock = mock('verify_call')
|
|
218
218
|
@proxy = Mock.install_method @mock, :method_call
|
|
@@ -318,7 +318,7 @@ end
|
|
|
318
318
|
describe Mock, ".verify_count" do
|
|
319
319
|
before :each do
|
|
320
320
|
MSpec.stub!(:actions)
|
|
321
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
321
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
322
322
|
|
|
323
323
|
@mock = mock('verify_count')
|
|
324
324
|
@proxy = Mock.install_method @mock, :method_call
|
|
@@ -381,7 +381,7 @@ end
|
|
|
381
381
|
describe Mock, ".verify_count mixing mocks and stubs" do
|
|
382
382
|
before :each do
|
|
383
383
|
MSpec.stub!(:actions)
|
|
384
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
384
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
385
385
|
|
|
386
386
|
@mock = mock('verify_count')
|
|
387
387
|
end
|
|
@@ -413,7 +413,7 @@ end
|
|
|
413
413
|
describe Mock, ".cleanup" do
|
|
414
414
|
before :each do
|
|
415
415
|
MSpec.stub!(:actions)
|
|
416
|
-
MSpec.stub!(:current).and_return(mock("spec state"
|
|
416
|
+
MSpec.stub!(:current).and_return(mock("spec state").as_null_object)
|
|
417
417
|
|
|
418
418
|
@mock = mock('cleanup')
|
|
419
419
|
@proxy = Mock.install_method @mock, :method_call
|
data/spec/mocks/proxy_spec.rb
CHANGED
|
@@ -9,7 +9,7 @@ describe GdbAction do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it "creates an MatchFilter with its tag and desc arguments" do
|
|
12
|
-
filter = mock('action filter'
|
|
12
|
+
filter = mock('action filter').as_null_object
|
|
13
13
|
MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
|
|
14
14
|
GdbAction.new ["tag", "key"], ["some", "thing"]
|
|
15
15
|
end
|
|
@@ -6,7 +6,7 @@ require 'mspec/runner/tag'
|
|
|
6
6
|
|
|
7
7
|
describe TagAction, ".new" do
|
|
8
8
|
it "creates an MatchFilter with its tag and desc arguments" do
|
|
9
|
-
filter = mock('action filter'
|
|
9
|
+
filter = mock('action filter').as_null_object
|
|
10
10
|
MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
|
|
11
11
|
TagAction.new :add, :all, nil, nil, ["tag", "key"], ["some", "thing"]
|
|
12
12
|
end
|
|
@@ -14,7 +14,7 @@ describe TagListAction, "#===" do
|
|
|
14
14
|
before :each do
|
|
15
15
|
tag = SpecTag.new "fails:description"
|
|
16
16
|
MSpec.stub!(:read_tags).and_return([tag])
|
|
17
|
-
@filter = mock("MatchFilter"
|
|
17
|
+
@filter = mock("MatchFilter").as_null_object
|
|
18
18
|
MatchFilter.stub!(:new).and_return(@filter)
|
|
19
19
|
@action = TagListAction.new
|
|
20
20
|
@action.load
|
data/spec/runner/context_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
require 'mspec/expectations/expectations'
|
|
3
3
|
require 'mspec/matchers/base'
|
|
4
4
|
require 'mspec/runner/mspec'
|
|
@@ -9,7 +9,7 @@ require 'mspec/runner/example'
|
|
|
9
9
|
describe ContextState, "#describe" do
|
|
10
10
|
before :each do
|
|
11
11
|
@state = ContextState.new "C#m"
|
|
12
|
-
@proc = lambda { ScratchPad.record :a }
|
|
12
|
+
@proc = lambda {|*| ScratchPad.record :a }
|
|
13
13
|
ScratchPad.clear
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -90,7 +90,7 @@ end
|
|
|
90
90
|
describe ContextState, "#it" do
|
|
91
91
|
before :each do
|
|
92
92
|
@state = ContextState.new ""
|
|
93
|
-
@proc = lambda { }
|
|
93
|
+
@proc = lambda {|*| }
|
|
94
94
|
|
|
95
95
|
@ex = ExampleState.new("", "", &@proc)
|
|
96
96
|
end
|
|
@@ -129,7 +129,7 @@ end
|
|
|
129
129
|
describe ContextState, "#before" do
|
|
130
130
|
before :each do
|
|
131
131
|
@state = ContextState.new ""
|
|
132
|
-
@proc = lambda { }
|
|
132
|
+
@proc = lambda {|*| }
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
it "records the block for :each" do
|
|
@@ -146,7 +146,7 @@ end
|
|
|
146
146
|
describe ContextState, "#after" do
|
|
147
147
|
before :each do
|
|
148
148
|
@state = ContextState.new ""
|
|
149
|
-
@proc = lambda { }
|
|
149
|
+
@proc = lambda {|*| }
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
it "records the block for :each" do
|
|
@@ -162,9 +162,9 @@ end
|
|
|
162
162
|
|
|
163
163
|
describe ContextState, "#pre" do
|
|
164
164
|
before :each do
|
|
165
|
-
@a = lambda { }
|
|
166
|
-
@b = lambda { }
|
|
167
|
-
@c = lambda { }
|
|
165
|
+
@a = lambda {|*| }
|
|
166
|
+
@b = lambda {|*| }
|
|
167
|
+
@c = lambda {|*| }
|
|
168
168
|
|
|
169
169
|
parent = ContextState.new ""
|
|
170
170
|
parent.before(:each, &@c)
|
|
@@ -189,9 +189,9 @@ end
|
|
|
189
189
|
|
|
190
190
|
describe ContextState, "#post" do
|
|
191
191
|
before :each do
|
|
192
|
-
@a = lambda { }
|
|
193
|
-
@b = lambda { }
|
|
194
|
-
@c = lambda { }
|
|
192
|
+
@a = lambda {|*| }
|
|
193
|
+
@b = lambda {|*| }
|
|
194
|
+
@c = lambda {|*| }
|
|
195
195
|
|
|
196
196
|
parent = ContextState.new ""
|
|
197
197
|
parent.after(:each, &@c)
|
|
@@ -217,9 +217,9 @@ end
|
|
|
217
217
|
describe ContextState, "#protect" do
|
|
218
218
|
before :each do
|
|
219
219
|
ScratchPad.record []
|
|
220
|
-
@a = lambda { ScratchPad << :a }
|
|
221
|
-
@b = lambda { ScratchPad << :b }
|
|
222
|
-
@c = lambda { raise Exception, "Fail!" }
|
|
220
|
+
@a = lambda {|*| ScratchPad << :a }
|
|
221
|
+
@b = lambda {|*| ScratchPad << :b }
|
|
222
|
+
@c = lambda {|*| raise Exception, "Fail!" }
|
|
223
223
|
end
|
|
224
224
|
|
|
225
225
|
it "returns true and does execute any blocks if check and MSpec.mode?(:pretend) are true" do
|
|
@@ -374,8 +374,8 @@ describe ContextState, "#process" do
|
|
|
374
374
|
@state = ContextState.new ""
|
|
375
375
|
@state.describe { }
|
|
376
376
|
|
|
377
|
-
@a = lambda { ScratchPad << :a }
|
|
378
|
-
@b = lambda { ScratchPad << :b }
|
|
377
|
+
@a = lambda {|*| ScratchPad << :a }
|
|
378
|
+
@b = lambda {|*| ScratchPad << :b }
|
|
379
379
|
ScratchPad.record []
|
|
380
380
|
end
|
|
381
381
|
|
|
@@ -658,8 +658,8 @@ describe ContextState, "#process when an exception is raised in before(:all)" do
|
|
|
658
658
|
@state = ContextState.new ""
|
|
659
659
|
@state.describe { }
|
|
660
660
|
|
|
661
|
-
@a = lambda { ScratchPad << :a }
|
|
662
|
-
@b = lambda { ScratchPad << :b }
|
|
661
|
+
@a = lambda {|*| ScratchPad << :a }
|
|
662
|
+
@b = lambda {|*| ScratchPad << :b }
|
|
663
663
|
ScratchPad.record []
|
|
664
664
|
|
|
665
665
|
@state.before(:all) { raise Exception, "Fail!" }
|
|
@@ -718,8 +718,8 @@ describe ContextState, "#process when an exception is raised in before(:each)" d
|
|
|
718
718
|
@state = ContextState.new ""
|
|
719
719
|
@state.describe { }
|
|
720
720
|
|
|
721
|
-
@a = lambda { ScratchPad << :a }
|
|
722
|
-
@b = lambda { ScratchPad << :b }
|
|
721
|
+
@a = lambda {|*| ScratchPad << :a }
|
|
722
|
+
@b = lambda {|*| ScratchPad << :b }
|
|
723
723
|
ScratchPad.record []
|
|
724
724
|
|
|
725
725
|
@state.before(:each) { raise Exception, "Fail!" }
|
|
@@ -756,7 +756,7 @@ describe ContextState, "#process in pretend mode" do
|
|
|
756
756
|
end
|
|
757
757
|
|
|
758
758
|
after :all do
|
|
759
|
-
MSpec.
|
|
759
|
+
MSpec.clear_modes
|
|
760
760
|
end
|
|
761
761
|
|
|
762
762
|
before :each do
|
|
@@ -805,7 +805,7 @@ describe ContextState, "#process in pretend mode" do
|
|
|
805
805
|
end
|
|
806
806
|
|
|
807
807
|
after :all do
|
|
808
|
-
MSpec.
|
|
808
|
+
MSpec.clear_modes
|
|
809
809
|
end
|
|
810
810
|
|
|
811
811
|
before :each do
|
|
@@ -815,8 +815,8 @@ describe ContextState, "#process in pretend mode" do
|
|
|
815
815
|
@state = ContextState.new ""
|
|
816
816
|
@state.describe { }
|
|
817
817
|
|
|
818
|
-
@a = lambda { ScratchPad << :a }
|
|
819
|
-
@b = lambda { ScratchPad << :b }
|
|
818
|
+
@a = lambda {|*| ScratchPad << :a }
|
|
819
|
+
@b = lambda {|*| ScratchPad << :b }
|
|
820
820
|
ScratchPad.record []
|
|
821
821
|
end
|
|
822
822
|
|
|
@@ -880,7 +880,7 @@ describe ContextState, "#process in pretend mode" do
|
|
|
880
880
|
end
|
|
881
881
|
|
|
882
882
|
after :all do
|
|
883
|
-
MSpec.
|
|
883
|
+
MSpec.clear_modes
|
|
884
884
|
end
|
|
885
885
|
|
|
886
886
|
before :each do
|
|
@@ -921,8 +921,8 @@ describe ContextState, "#it_should_behave_like" do
|
|
|
921
921
|
MSpec.stub!(:retrieve_shared).and_return(@shared)
|
|
922
922
|
|
|
923
923
|
@state = ContextState.new "Top level"
|
|
924
|
-
@a = lambda { }
|
|
925
|
-
@b = lambda { }
|
|
924
|
+
@a = lambda {|*| }
|
|
925
|
+
@b = lambda {|*| }
|
|
926
926
|
end
|
|
927
927
|
|
|
928
928
|
it "raises an Exception if unable to find the shared ContextState" do
|
data/spec/runner/example_spec.rb
CHANGED