mspec 1.8.0 → 1.9.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.
- checksums.yaml +4 -4
- data/lib/mspec/matchers.rb +1 -0
- data/lib/mspec/matchers/block_caller.rb +34 -0
- data/lib/mspec/runner/actions/timer.rb +6 -2
- data/lib/mspec/runner/context.rb +1 -1
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mspec_spec.rb +2 -2
- data/spec/commands/mspec_tag_spec.rb +3 -3
- data/spec/guards/background_spec.rb +1 -1
- data/spec/guards/feature_spec.rb +4 -4
- data/spec/guards/guard_spec.rb +2 -2
- data/spec/helpers/fs_spec.rb +12 -12
- data/spec/helpers/numeric_spec.rb +1 -1
- data/spec/matchers/be_an_instance_of_spec.rb +6 -6
- data/spec/matchers/be_computed_by_function_spec.rb +4 -4
- data/spec/matchers/be_computed_by_spec.rb +5 -5
- data/spec/matchers/be_valid_dns_name_spec.rb +8 -8
- data/spec/matchers/block_caller_spec.rb +13 -0
- data/spec/matchers/equal_element_spec.rb +32 -32
- data/spec/matchers/have_class_variable_spec.rb +4 -4
- data/spec/matchers/have_constant_spec.rb +2 -2
- data/spec/matchers/have_data_spec.rb +4 -4
- data/spec/matchers/have_instance_method_spec.rb +4 -4
- data/spec/matchers/have_instance_variable_spec.rb +4 -4
- data/spec/matchers/have_method_spec.rb +6 -6
- data/spec/matchers/have_private_instance_method_spec.rb +4 -4
- data/spec/matchers/have_private_method_spec.rb +2 -2
- data/spec/matchers/have_protected_instance_method_spec.rb +4 -4
- data/spec/matchers/have_public_instance_method_spec.rb +4 -4
- data/spec/matchers/have_singleton_method_spec.rb +2 -2
- data/spec/mocks/mock_spec.rb +5 -5
- data/spec/mocks/proxy_spec.rb +8 -8
- data/spec/runner/actions/tag_spec.rb +7 -7
- data/spec/runner/actions/taglist_spec.rb +3 -3
- data/spec/runner/actions/timer_spec.rb +4 -4
- data/spec/runner/context_spec.rb +17 -17
- data/spec/runner/exception_spec.rb +3 -3
- data/spec/runner/formatters/dotted_spec.rb +15 -15
- data/spec/runner/formatters/file_spec.rb +4 -4
- data/spec/runner/formatters/specdoc_spec.rb +2 -2
- data/spec/runner/mspec_spec.rb +19 -15
- data/spec/utils/options_spec.rb +9 -11
- metadata +6 -3
@@ -4,72 +4,72 @@ require 'mspec/matchers'
|
|
4
4
|
|
5
5
|
describe EqualElementMatcher do
|
6
6
|
it "matches if it finds an element with the passed name, no matter what attributes/content" do
|
7
|
-
EqualElementMatcher.new("A").matches?('<A></A>').should
|
8
|
-
EqualElementMatcher.new("A").matches?('<A HREF="http://example.com"></A>').should
|
9
|
-
EqualElementMatcher.new("A").matches?('<A HREF="http://example.com"></A>').should
|
7
|
+
EqualElementMatcher.new("A").matches?('<A></A>').should be_truthy
|
8
|
+
EqualElementMatcher.new("A").matches?('<A HREF="http://example.com"></A>').should be_truthy
|
9
|
+
EqualElementMatcher.new("A").matches?('<A HREF="http://example.com"></A>').should be_truthy
|
10
10
|
|
11
|
-
EqualElementMatcher.new("BASE").matches?('<BASE></A>').should
|
12
|
-
EqualElementMatcher.new("BASE").matches?('<A></BASE>').should
|
13
|
-
EqualElementMatcher.new("BASE").matches?('<A></A>').should
|
14
|
-
EqualElementMatcher.new("BASE").matches?('<A HREF="http://example.com"></A>').should
|
15
|
-
EqualElementMatcher.new("BASE").matches?('<A HREF="http://example.com"></A>').should
|
11
|
+
EqualElementMatcher.new("BASE").matches?('<BASE></A>').should be_falsey
|
12
|
+
EqualElementMatcher.new("BASE").matches?('<A></BASE>').should be_falsey
|
13
|
+
EqualElementMatcher.new("BASE").matches?('<A></A>').should be_falsey
|
14
|
+
EqualElementMatcher.new("BASE").matches?('<A HREF="http://example.com"></A>').should be_falsey
|
15
|
+
EqualElementMatcher.new("BASE").matches?('<A HREF="http://example.com"></A>').should be_falsey
|
16
16
|
end
|
17
17
|
|
18
18
|
it "matches if it finds an element with the passed name and the passed attributes" do
|
19
|
-
EqualElementMatcher.new("A", {}).matches?('<A></A>').should
|
20
|
-
EqualElementMatcher.new("A", nil).matches?('<A HREF="http://example.com"></A>').should
|
21
|
-
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://example.com"></A>').should
|
19
|
+
EqualElementMatcher.new("A", {}).matches?('<A></A>').should be_truthy
|
20
|
+
EqualElementMatcher.new("A", nil).matches?('<A HREF="http://example.com"></A>').should be_truthy
|
21
|
+
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://example.com"></A>').should be_truthy
|
22
22
|
|
23
|
-
EqualElementMatcher.new("A", {}).matches?('<A HREF="http://example.com"></A>').should
|
24
|
-
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A></A>').should
|
25
|
-
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://test.com"></A>').should
|
26
|
-
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://example.com" HREF="http://example.com"></A>').should
|
23
|
+
EqualElementMatcher.new("A", {}).matches?('<A HREF="http://example.com"></A>').should be_falsey
|
24
|
+
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A></A>').should be_falsey
|
25
|
+
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://test.com"></A>').should be_falsey
|
26
|
+
EqualElementMatcher.new("A", "HREF" => "http://example.com").matches?('<A HREF="http://example.com" HREF="http://example.com"></A>').should be_falsey
|
27
27
|
end
|
28
28
|
|
29
29
|
it "matches if it finds an element with the passed name, the passed attributes and the passed content" do
|
30
|
-
EqualElementMatcher.new("A", {}, "").matches?('<A></A>').should
|
31
|
-
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com">Example</A>').should
|
30
|
+
EqualElementMatcher.new("A", {}, "").matches?('<A></A>').should be_truthy
|
31
|
+
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com">Example</A>').should be_truthy
|
32
32
|
|
33
|
-
EqualElementMatcher.new("A", {}, "Test").matches?('<A></A>').should
|
34
|
-
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com"></A>').should
|
35
|
-
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com">Test</A>').should
|
33
|
+
EqualElementMatcher.new("A", {}, "Test").matches?('<A></A>').should be_falsey
|
34
|
+
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com"></A>').should be_falsey
|
35
|
+
EqualElementMatcher.new("A", {"HREF" => "http://example.com"}, "Example").matches?('<A HREF="http://example.com">Test</A>').should be_falsey
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can match unclosed elements" do
|
39
|
-
EqualElementMatcher.new("BASE", nil, nil, :not_closed => true).matches?('<BASE>').should
|
40
|
-
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, nil, :not_closed => true).matches?('<BASE HREF="http://example.com">').should
|
41
|
-
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "Example", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should
|
39
|
+
EqualElementMatcher.new("BASE", nil, nil, :not_closed => true).matches?('<BASE>').should be_truthy
|
40
|
+
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, nil, :not_closed => true).matches?('<BASE HREF="http://example.com">').should be_truthy
|
41
|
+
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "Example", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should be_truthy
|
42
42
|
|
43
|
-
EqualElementMatcher.new("BASE", {}, nil, :not_closed => true).matches?('<BASE HREF="http://example.com">').should
|
44
|
-
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should
|
45
|
-
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "Test", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should
|
43
|
+
EqualElementMatcher.new("BASE", {}, nil, :not_closed => true).matches?('<BASE HREF="http://example.com">').should be_falsey
|
44
|
+
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should be_falsey
|
45
|
+
EqualElementMatcher.new("BASE", {"HREF" => "http://example.com"}, "Test", :not_closed => true).matches?('<BASE HREF="http://example.com">Example').should be_falsey
|
46
46
|
end
|
47
47
|
|
48
48
|
it "provides a useful failure message" do
|
49
49
|
equal_element = EqualElementMatcher.new("A", {}, "Test")
|
50
|
-
equal_element.matches?('<A></A>').should
|
50
|
+
equal_element.matches?('<A></A>').should be_falsey
|
51
51
|
equal_element.failure_message.should == [%{Expected "<A></A>"\n}, %{to be a 'A' element with no attributes and "Test" as content}]
|
52
52
|
|
53
53
|
equal_element = EqualElementMatcher.new("A", {}, "")
|
54
|
-
equal_element.matches?('<A>Test</A>').should
|
54
|
+
equal_element.matches?('<A>Test</A>').should be_falsey
|
55
55
|
equal_element.failure_message.should == [%{Expected "<A>Test</A>"\n}, %{to be a 'A' element with no attributes and no content}]
|
56
56
|
|
57
57
|
equal_element = EqualElementMatcher.new("A", "HREF" => "http://www.example.com")
|
58
|
-
equal_element.matches?('<A>Test</A>').should
|
58
|
+
equal_element.matches?('<A>Test</A>').should be_falsey
|
59
59
|
equal_element.failure_message.should == [%{Expected "<A>Test</A>"\n}, %{to be a 'A' element with HREF="http://www.example.com" and any content}]
|
60
60
|
end
|
61
61
|
|
62
62
|
it "provides a useful negative failure message" do
|
63
63
|
equal_element = EqualElementMatcher.new("A", {}, "Test")
|
64
|
-
equal_element.matches?('<A></A>').should
|
64
|
+
equal_element.matches?('<A></A>').should be_falsey
|
65
65
|
equal_element.negative_failure_message.should == [%{Expected "<A></A>"\n}, %{not to be a 'A' element with no attributes and "Test" as content}]
|
66
66
|
|
67
67
|
equal_element = EqualElementMatcher.new("A", {}, "")
|
68
|
-
equal_element.matches?('<A>Test</A>').should
|
68
|
+
equal_element.matches?('<A>Test</A>').should be_falsey
|
69
69
|
equal_element.negative_failure_message.should == [%{Expected "<A>Test</A>"\n}, %{not to be a 'A' element with no attributes and no content}]
|
70
70
|
|
71
71
|
equal_element = EqualElementMatcher.new("A", "HREF" => "http://www.example.com")
|
72
|
-
equal_element.matches?('<A>Test</A>').should
|
72
|
+
equal_element.matches?('<A>Test</A>').should be_falsey
|
73
73
|
equal_element.negative_failure_message.should == [%{Expected "<A>Test</A>"\n}, %{not to be a 'A' element with HREF="http://www.example.com" and any content}]
|
74
74
|
end
|
75
75
|
end
|
@@ -11,22 +11,22 @@ shared_examples_for "have_class_variable, on all Ruby versions" do
|
|
11
11
|
|
12
12
|
it "matches when mod has the class variable, given as string" do
|
13
13
|
matcher = HaveClassVariableMatcher.new('@foo')
|
14
|
-
matcher.matches?(IVarModMock).should
|
14
|
+
matcher.matches?(IVarModMock).should be_truthy
|
15
15
|
end
|
16
16
|
|
17
17
|
it "matches when mod has the class variable, given as symbol" do
|
18
18
|
matcher = HaveClassVariableMatcher.new(:@foo)
|
19
|
-
matcher.matches?(IVarModMock).should
|
19
|
+
matcher.matches?(IVarModMock).should be_truthy
|
20
20
|
end
|
21
21
|
|
22
22
|
it "does not match when mod hasn't got the class variable, given as string" do
|
23
23
|
matcher = HaveClassVariableMatcher.new('@bar')
|
24
|
-
matcher.matches?(IVarModMock).should
|
24
|
+
matcher.matches?(IVarModMock).should be_falsey
|
25
25
|
end
|
26
26
|
|
27
27
|
it "does not match when mod hasn't got the class variable, given as symbol" do
|
28
28
|
matcher = HaveClassVariableMatcher.new(:@bar)
|
29
|
-
matcher.matches?(IVarModMock).should
|
29
|
+
matcher.matches?(IVarModMock).should be_falsey
|
30
30
|
end
|
31
31
|
|
32
32
|
it "provides a failure message for #should" do
|
@@ -9,12 +9,12 @@ end
|
|
9
9
|
describe HaveConstantMatcher do
|
10
10
|
it "matches when mod has the constant" do
|
11
11
|
matcher = HaveConstantMatcher.new :X
|
12
|
-
matcher.matches?(HCMSpecs).should
|
12
|
+
matcher.matches?(HCMSpecs).should be_truthy
|
13
13
|
end
|
14
14
|
|
15
15
|
it "does not match when mod does not have the constant" do
|
16
16
|
matcher = HaveConstantMatcher.new :A
|
17
|
-
matcher.matches?(HCMSpecs).should
|
17
|
+
matcher.matches?(HCMSpecs).should be_falsey
|
18
18
|
end
|
19
19
|
|
20
20
|
it "provides a failure message for #should" do
|
@@ -21,19 +21,19 @@ describe HaveDataMatcher do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "matches when the named file begins with the same bytes as data" do
|
24
|
-
HaveDataMatcher.new("123a").matches?(@name).should
|
24
|
+
HaveDataMatcher.new("123a").matches?(@name).should be_truthy
|
25
25
|
end
|
26
26
|
|
27
27
|
it "does not match when the named file begins with fewer bytes than data" do
|
28
|
-
HaveDataMatcher.new("123abcPQR").matches?(@name).should
|
28
|
+
HaveDataMatcher.new("123abcPQR").matches?(@name).should be_falsey
|
29
29
|
end
|
30
30
|
|
31
31
|
it "does not match when the named file begins with different bytes than data" do
|
32
|
-
HaveDataMatcher.new("abc1").matches?(@name).should
|
32
|
+
HaveDataMatcher.new("abc1").matches?(@name).should be_falsey
|
33
33
|
end
|
34
34
|
|
35
35
|
it "accepts an optional mode argument to open the data file" do
|
36
|
-
HaveDataMatcher.new("123a", "r").matches?(@name).should
|
36
|
+
HaveDataMatcher.new("123a", "r").matches?(@name).should be_truthy
|
37
37
|
end
|
38
38
|
|
39
39
|
it "provides a useful failure message" do
|
@@ -19,18 +19,18 @@ describe HaveInstanceMethodMatcher do
|
|
19
19
|
|
20
20
|
it "matches when mod has the instance method" do
|
21
21
|
matcher = HaveInstanceMethodMatcher.new :instance_method
|
22
|
-
matcher.matches?(HIMMSpecs).should
|
23
|
-
matcher.matches?(HIMMSpecs::Subclass).should
|
22
|
+
matcher.matches?(HIMMSpecs).should be_truthy
|
23
|
+
matcher.matches?(HIMMSpecs::Subclass).should be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it "does not match when mod does not have the instance method" do
|
27
27
|
matcher = HaveInstanceMethodMatcher.new :another_method
|
28
|
-
matcher.matches?(HIMMSpecs).should
|
28
|
+
matcher.matches?(HIMMSpecs).should be_falsey
|
29
29
|
end
|
30
30
|
|
31
31
|
it "does not match if the method is in a superclass and include_super is false" do
|
32
32
|
matcher = HaveInstanceMethodMatcher.new :instance_method, false
|
33
|
-
matcher.matches?(HIMMSpecs::Subclass).should
|
33
|
+
matcher.matches?(HIMMSpecs::Subclass).should be_falsey
|
34
34
|
end
|
35
35
|
|
36
36
|
it "provides a failure message for #should" do
|
@@ -9,22 +9,22 @@ shared_examples_for "have_instance_variable, on all Ruby versions" do
|
|
9
9
|
|
10
10
|
it "matches when object has the instance variable, given as string" do
|
11
11
|
matcher = HaveInstanceVariableMatcher.new('@foo')
|
12
|
-
matcher.matches?(@object).should
|
12
|
+
matcher.matches?(@object).should be_truthy
|
13
13
|
end
|
14
14
|
|
15
15
|
it "matches when object has the instance variable, given as symbol" do
|
16
16
|
matcher = HaveInstanceVariableMatcher.new(:@foo)
|
17
|
-
matcher.matches?(@object).should
|
17
|
+
matcher.matches?(@object).should be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it "does not match when object hasn't got the instance variable, given as string" do
|
21
21
|
matcher = HaveInstanceVariableMatcher.new('@bar')
|
22
|
-
matcher.matches?(@object).should
|
22
|
+
matcher.matches?(@object).should be_falsey
|
23
23
|
end
|
24
24
|
|
25
25
|
it "does not match when object hasn't got the instance variable, given as symbol" do
|
26
26
|
matcher = HaveInstanceVariableMatcher.new(:@bar)
|
27
|
-
matcher.matches?(@object).should
|
27
|
+
matcher.matches?(@object).should be_falsey
|
28
28
|
end
|
29
29
|
|
30
30
|
it "provides a failure message for #should" do
|
@@ -19,20 +19,20 @@ describe HaveMethodMatcher do
|
|
19
19
|
|
20
20
|
it "matches when mod has the method" do
|
21
21
|
matcher = HaveMethodMatcher.new :instance_method
|
22
|
-
matcher.matches?(HMMSpecs).should
|
23
|
-
matcher.matches?(HMMSpecs.new).should
|
24
|
-
matcher.matches?(HMMSpecs::Subclass).should
|
25
|
-
matcher.matches?(HMMSpecs::Subclass.new).should
|
22
|
+
matcher.matches?(HMMSpecs).should be_truthy
|
23
|
+
matcher.matches?(HMMSpecs.new).should be_truthy
|
24
|
+
matcher.matches?(HMMSpecs::Subclass).should be_truthy
|
25
|
+
matcher.matches?(HMMSpecs::Subclass.new).should be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it "does not match when mod does not have the method" do
|
29
29
|
matcher = HaveMethodMatcher.new :another_method
|
30
|
-
matcher.matches?(HMMSpecs).should
|
30
|
+
matcher.matches?(HMMSpecs).should be_falsey
|
31
31
|
end
|
32
32
|
|
33
33
|
it "does not match if the method is in a superclass and include_super is false" do
|
34
34
|
matcher = HaveMethodMatcher.new :instance_method, false
|
35
|
-
matcher.matches?(HMMSpecs::Subclass).should
|
35
|
+
matcher.matches?(HMMSpecs::Subclass).should be_falsey
|
36
36
|
end
|
37
37
|
|
38
38
|
it "provides a failure message for #should" do
|
@@ -23,18 +23,18 @@ describe HavePrivateInstanceMethodMatcher do
|
|
23
23
|
|
24
24
|
it "matches when mod has the private instance method" do
|
25
25
|
matcher = HavePrivateInstanceMethodMatcher.new :private_method
|
26
|
-
matcher.matches?(HPIMMSpecs).should
|
27
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
26
|
+
matcher.matches?(HPIMMSpecs).should be_truthy
|
27
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_truthy
|
28
28
|
end
|
29
29
|
|
30
30
|
it "does not match when mod does not have the private instance method" do
|
31
31
|
matcher = HavePrivateInstanceMethodMatcher.new :another_method
|
32
|
-
matcher.matches?(HPIMMSpecs).should
|
32
|
+
matcher.matches?(HPIMMSpecs).should be_falsey
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does not match if the method is in a superclass and include_super is false" do
|
36
36
|
matcher = HavePrivateInstanceMethodMatcher.new :private_method, false
|
37
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
37
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_falsey
|
38
38
|
end
|
39
39
|
|
40
40
|
it "provides a failure message for #should" do
|
@@ -16,12 +16,12 @@ describe HavePrivateMethodMatcher do
|
|
16
16
|
|
17
17
|
it "matches when mod has the private method" do
|
18
18
|
matcher = HavePrivateMethodMatcher.new :private_method
|
19
|
-
matcher.matches?(HPMMSpecs).should
|
19
|
+
matcher.matches?(HPMMSpecs).should be_truthy
|
20
20
|
end
|
21
21
|
|
22
22
|
it "does not match when mod does not have the private method" do
|
23
23
|
matcher = HavePrivateMethodMatcher.new :another_method
|
24
|
-
matcher.matches?(HPMMSpecs).should
|
24
|
+
matcher.matches?(HPMMSpecs).should be_falsey
|
25
25
|
end
|
26
26
|
|
27
27
|
it "provides a failure message for #should" do
|
@@ -23,18 +23,18 @@ describe HaveProtectedInstanceMethodMatcher do
|
|
23
23
|
|
24
24
|
it "matches when mod has the protected instance method" do
|
25
25
|
matcher = HaveProtectedInstanceMethodMatcher.new :protected_method
|
26
|
-
matcher.matches?(HPIMMSpecs).should
|
27
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
26
|
+
matcher.matches?(HPIMMSpecs).should be_truthy
|
27
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_truthy
|
28
28
|
end
|
29
29
|
|
30
30
|
it "does not match when mod does not have the protected instance method" do
|
31
31
|
matcher = HaveProtectedInstanceMethodMatcher.new :another_method
|
32
|
-
matcher.matches?(HPIMMSpecs).should
|
32
|
+
matcher.matches?(HPIMMSpecs).should be_falsey
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does not match if the method is in a superclass and include_super is false" do
|
36
36
|
matcher = HaveProtectedInstanceMethodMatcher.new :protected_method, false
|
37
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
37
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_falsey
|
38
38
|
end
|
39
39
|
|
40
40
|
it "provides a failure message for #should" do
|
@@ -19,18 +19,18 @@ describe HavePublicInstanceMethodMatcher do
|
|
19
19
|
|
20
20
|
it "matches when mod has the public instance method" do
|
21
21
|
matcher = HavePublicInstanceMethodMatcher.new :public_method
|
22
|
-
matcher.matches?(HPIMMSpecs).should
|
23
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
22
|
+
matcher.matches?(HPIMMSpecs).should be_truthy
|
23
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it "does not match when mod does not have the public instance method" do
|
27
27
|
matcher = HavePublicInstanceMethodMatcher.new :another_method
|
28
|
-
matcher.matches?(HPIMMSpecs).should
|
28
|
+
matcher.matches?(HPIMMSpecs).should be_falsey
|
29
29
|
end
|
30
30
|
|
31
31
|
it "does not match if the method is in a superclass and include_super is false" do
|
32
32
|
matcher = HavePublicInstanceMethodMatcher.new :public_method, false
|
33
|
-
matcher.matches?(HPIMMSpecs::Subclass).should
|
33
|
+
matcher.matches?(HPIMMSpecs::Subclass).should be_falsey
|
34
34
|
end
|
35
35
|
|
36
36
|
it "provides a failure message for #should" do
|
@@ -14,7 +14,7 @@ describe HaveSingletonMethodMatcher do
|
|
14
14
|
|
15
15
|
it "matches when the class has a singleton method" do
|
16
16
|
matcher = HaveSingletonMethodMatcher.new :singleton_method
|
17
|
-
matcher.matches?(HSMMSpecs).should
|
17
|
+
matcher.matches?(HSMMSpecs).should be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it "matches when the object has a singleton method" do
|
@@ -22,7 +22,7 @@ describe HaveSingletonMethodMatcher do
|
|
22
22
|
def obj.singleton_method; end
|
23
23
|
|
24
24
|
matcher = HaveSingletonMethodMatcher.new :singleton_method
|
25
|
-
matcher.matches?(obj).should
|
25
|
+
matcher.matches?(obj).should be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it "provides a failure message for #should" do
|
data/spec/mocks/mock_spec.rb
CHANGED
@@ -44,16 +44,16 @@ describe Mock, ".replaced?" do
|
|
44
44
|
|
45
45
|
it "returns true if a method has been stubbed on an object" do
|
46
46
|
Mock.install_method @mock, :method_call
|
47
|
-
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should
|
47
|
+
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should be_truthy
|
48
48
|
end
|
49
49
|
|
50
50
|
it "returns true if a method has been mocked on an object" do
|
51
51
|
Mock.install_method @mock, :method_call, :stub
|
52
|
-
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should
|
52
|
+
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should be_truthy
|
53
53
|
end
|
54
54
|
|
55
55
|
it "returns false if a method has not been stubbed or mocked" do
|
56
|
-
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should
|
56
|
+
Mock.replaced?(Mock.replaced_name(@mock, :method_call)).should be_falsey
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -461,9 +461,9 @@ describe Mock, ".cleanup" do
|
|
461
461
|
Mock.should_receive(:clear_replaced).with(replaced_key)
|
462
462
|
|
463
463
|
replaced_name = Mock.replaced_name(@mock, :method_call)
|
464
|
-
Mock.replaced?(replaced_name).should
|
464
|
+
Mock.replaced?(replaced_name).should be_truthy
|
465
465
|
|
466
466
|
Mock.cleanup
|
467
|
-
Mock.replaced?(replaced_name).should
|
467
|
+
Mock.replaced?(replaced_name).should be_falsey
|
468
468
|
end
|
469
469
|
end
|
data/spec/mocks/proxy_spec.rb
CHANGED
@@ -15,11 +15,11 @@ end
|
|
15
15
|
|
16
16
|
describe MockProxy, ".new" do
|
17
17
|
it "creates a mock proxy by default" do
|
18
|
-
MockProxy.new.mock?.should
|
18
|
+
MockProxy.new.mock?.should be_truthy
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates a stub proxy by request" do
|
22
|
-
MockProxy.new(:stub).stub?.should
|
22
|
+
MockProxy.new(:stub).stub?.should be_truthy
|
23
23
|
end
|
24
24
|
|
25
25
|
it "sets the call expectation to 1 call for a mock" do
|
@@ -294,21 +294,21 @@ end
|
|
294
294
|
|
295
295
|
describe MockProxy, "#stub?" do
|
296
296
|
it "returns true if the proxy is created as a stub" do
|
297
|
-
MockProxy.new(:stub).stub?.should
|
297
|
+
MockProxy.new(:stub).stub?.should be_truthy
|
298
298
|
end
|
299
299
|
|
300
300
|
it "returns false if the proxy is created as a mock" do
|
301
|
-
MockProxy.new(:mock).stub?.should
|
301
|
+
MockProxy.new(:mock).stub?.should be_falsey
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
305
|
describe MockProxy, "#mock?" do
|
306
306
|
it "returns true if the proxy is created as a mock" do
|
307
|
-
MockProxy.new(:mock).mock?.should
|
307
|
+
MockProxy.new(:mock).mock?.should be_truthy
|
308
308
|
end
|
309
309
|
|
310
310
|
it "returns false if the proxy is created as a stub" do
|
311
|
-
MockProxy.new(:stub).mock?.should
|
311
|
+
MockProxy.new(:stub).mock?.should be_falsey
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
@@ -379,11 +379,11 @@ describe MockProxy, "#yielding?" do
|
|
379
379
|
end
|
380
380
|
|
381
381
|
it "returns false if the proxy is not yielding" do
|
382
|
-
@proxy.yielding?.should
|
382
|
+
@proxy.yielding?.should be_falsey
|
383
383
|
end
|
384
384
|
|
385
385
|
it "returns true if the proxy is yielding" do
|
386
386
|
@proxy.and_yield(1)
|
387
|
-
@proxy.yielding?.should
|
387
|
+
@proxy.yielding?.should be_truthy
|
388
388
|
end
|
389
389
|
end
|
@@ -40,12 +40,12 @@ describe TagAction, "#exception?" do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "returns false if no exception has been raised while evaluating an example" do
|
43
|
-
@action.exception?.should
|
43
|
+
@action.exception?.should be_falsey
|
44
44
|
end
|
45
45
|
|
46
46
|
it "returns true if an exception was raised while evaluating an example" do
|
47
47
|
@action.exception ExceptionState.new nil, nil, Exception.new("failed")
|
48
|
-
@action.exception?.should
|
48
|
+
@action.exception?.should be_truthy
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -87,20 +87,20 @@ end
|
|
87
87
|
describe TagAction, "#before" do
|
88
88
|
it "resets the #exception? flag to false" do
|
89
89
|
action = TagAction.new :add, :fail, nil, nil, nil, nil
|
90
|
-
action.exception?.should
|
90
|
+
action.exception?.should be_falsey
|
91
91
|
action.exception ExceptionState.new(nil, nil, Exception.new("Fail!"))
|
92
|
-
action.exception?.should
|
92
|
+
action.exception?.should be_truthy
|
93
93
|
action.before(ExampleState.new(ContextState.new("describe"), "it"))
|
94
|
-
action.exception?.should
|
94
|
+
action.exception?.should be_falsey
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
describe TagAction, "#exception" do
|
99
99
|
it "sets the #exception? flag" do
|
100
100
|
action = TagAction.new :add, :fail, nil, nil, nil, nil
|
101
|
-
action.exception?.should
|
101
|
+
action.exception?.should be_falsey
|
102
102
|
action.exception ExceptionState.new(nil, nil, Exception.new("Fail!"))
|
103
|
-
action.exception?.should
|
103
|
+
action.exception?.should be_truthy
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|