rspec 0.4.0 → 0.5.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.
- data/CHANGES +7 -12
- data/Rakefile +17 -12
- data/TUTORIAL +1 -1
- data/WHY_RSPEC +115 -0
- data/bin/spec +17 -4
- data/bin/test2rspec +35 -0
- data/examples/airport_spec.rb +35 -0
- data/examples/mocking_spec.rb +16 -0
- data/examples/spec_framework_spec.rb +28 -0
- data/examples/stack.rb +36 -0
- data/examples/stack_spec.rb +112 -0
- data/lib/spec.rb +5 -18
- data/lib/spec/api.rb +4 -0
- data/lib/spec/{exceptions.rb → api/exceptions.rb} +1 -1
- data/lib/spec/{expectations.rb → api/expectations.rb} +5 -4
- data/lib/spec/api/helper.rb +10 -0
- data/lib/spec/{have_helper.rb → api/helper/have_helper.rb} +1 -1
- data/lib/spec/{instance_helper.rb → api/helper/instance_helper.rb} +0 -0
- data/lib/spec/{instance_negator.rb → api/helper/instance_negator.rb} +0 -0
- data/lib/spec/{kind_helper.rb → api/helper/kind_helper.rb} +0 -0
- data/lib/spec/{kind_negator.rb → api/helper/kind_negator.rb} +0 -0
- data/lib/spec/{respond_helper.rb → api/helper/respond_helper.rb} +0 -0
- data/lib/spec/{respond_negator.rb → api/helper/respond_negator.rb} +0 -0
- data/lib/spec/{should_base.rb → api/helper/should_base.rb} +6 -4
- data/lib/spec/{should_helper.rb → api/helper/should_helper.rb} +12 -0
- data/lib/spec/{should_negator.rb → api/helper/should_negator.rb} +11 -0
- data/lib/spec/api/mock.rb +184 -0
- data/lib/spec/rake/spectask.rb +153 -0
- data/lib/spec/runner.rb +9 -0
- data/lib/spec/runner/backtrace_tweaker.rb +17 -0
- data/lib/spec/runner/context.rb +47 -0
- data/lib/spec/runner/context_runner.rb +52 -0
- data/lib/spec/runner/execution_context.rb +15 -0
- data/lib/spec/runner/instance_exec.rb +15 -0
- data/lib/spec/runner/kernel_ext.rb +6 -0
- data/lib/spec/runner/option_parser.rb +41 -0
- data/lib/spec/runner/rdoc_formatter.rb +17 -0
- data/lib/spec/runner/simple_text_reporter.rb +92 -0
- data/lib/spec/runner/specification.rb +42 -0
- data/lib/spec/tool/command_line.rb +39 -0
- data/lib/spec/tool/test_unit_translator.rb +112 -0
- data/lib/spec/version.rb +13 -0
- data/test/spec/api/helper/arbitrary_predicate_test.rb +121 -0
- data/test/spec/api/helper/containment_test.rb +117 -0
- data/test/spec/api/helper/equality_test.rb +46 -0
- data/test/spec/api/helper/identity_test.rb +68 -0
- data/test/spec/api/helper/raising_test.rb +50 -0
- data/test/spec/api/helper/regex_matching_test.rb +38 -0
- data/test/spec/api/helper/should_satisfy_test.rb +37 -0
- data/test/spec/api/helper/throwing_test.rb +56 -0
- data/test/spec/api/helper/true_false_special_case_test.rb +87 -0
- data/test/spec/api/helper/typing_test.rb +107 -0
- data/test/spec/api/mock_test.rb +161 -0
- data/test/spec/runner/backtrace_tweaker_test.rb +20 -0
- data/test/spec/runner/context_runner_test.rb +19 -0
- data/test/spec/runner/context_test.rb +29 -0
- data/test/spec/runner/execution_context_test.rb +13 -0
- data/test/spec/runner/option_parser_test.rb +50 -0
- data/test/spec/runner/rdoc_formatter_test.rb +23 -0
- data/test/spec/runner/simple_text_reporter_test.rb +128 -0
- data/test/spec/runner/specification_test.rb +70 -0
- data/test/spec/tool/command_line_test.rb +22 -0
- data/test/spec/tool/test_unit_api_spec.rb +61 -0
- data/test/spec/tool/test_unit_api_test.rb +61 -0
- data/test/spec/tool/test_unit_translator_test.rb +29 -0
- data/test/test_helper.rb +8 -0
- metadata +89 -67
- data/examples/add_specification_spec.rb +0 -15
- data/examples/craps.rb +0 -15
- data/examples/craps_spec.rb +0 -105
- data/examples/dsl_spec.rb +0 -8
- data/examples/movie.rb +0 -7
- data/examples/movie_list.rb +0 -19
- data/examples/movie_spec.rb +0 -37
- data/lib/spec/collector.rb +0 -17
- data/lib/spec/context.rb +0 -89
- data/lib/spec/dsl.rb +0 -23
- data/lib/spec/gui_runner.rb +0 -59
- data/lib/spec/mock.rb +0 -183
- data/lib/spec/text_runner.rb +0 -75
- data/test/collection_owner.rb +0 -48
- data/test/context_fixtures_test.rb +0 -71
- data/test/context_run_test.rb +0 -174
- data/test/dsl_test.rb +0 -48
- data/test/error_reporting_test.rb +0 -225
- data/test/expectations_for_should_have_test.rb +0 -144
- data/test/expectations_test.rb +0 -592
- data/test/get_classes.rb +0 -6
- data/test/gui_runner_test.rb +0 -162
- data/test/mock_test.rb +0 -157
- data/test/spec_collection_test.rb +0 -39
- data/test/specification_addition_test.rb +0 -29
- data/test/specification_identification_test.rb +0 -71
- data/test/text_runner_test.rb +0 -146
data/lib/spec/version.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class ArbitraryPredicateTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# should.be.xxx
|
9
|
+
|
10
|
+
def test_should_be_xxx_should_raise_when_target_doesnt_understand_xxx
|
11
|
+
assert_raise(NoMethodError) do
|
12
|
+
5.should.be.xxx
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_be_xxx_should_raise_when_sending_xxx_to_target_returns_false
|
17
|
+
mock = Mock.new("xxx? returns false")
|
18
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(false)
|
19
|
+
assert_raise(ExpectationNotMetError) do
|
20
|
+
mock.should.be.xxx
|
21
|
+
end
|
22
|
+
mock.__verify
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_should_be_xxx_should_raise_when_sending_xxx_to_target_returns_nil
|
26
|
+
mock = Mock.new("xxx? returns nil")
|
27
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(nil)
|
28
|
+
assert_raise(ExpectationNotMetError) do
|
29
|
+
mock.should.be.xxx
|
30
|
+
end
|
31
|
+
mock.__verify
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_should_be_xxx_should_not_raise_when_sending_xxx_to_target_returns_true
|
35
|
+
mock = Mock.new("xxx? returns true")
|
36
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(true)
|
37
|
+
assert_nothing_raised do
|
38
|
+
mock.should.be.xxx
|
39
|
+
end
|
40
|
+
mock.__verify
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_should_be_xxx_should_not_raise_when_sending_xxx_to_target_returns_something_other_than_true_false_or_nil
|
44
|
+
mock = Mock.new("xxx? returns 5")
|
45
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(5)
|
46
|
+
assert_nothing_raised do
|
47
|
+
mock.should.be.xxx
|
48
|
+
end
|
49
|
+
mock.__verify
|
50
|
+
end
|
51
|
+
|
52
|
+
# should.be.xxx(args)
|
53
|
+
|
54
|
+
def test_should_be_xxx_with_args_passes_args_properly
|
55
|
+
mock = Mock.new("xxx?(1 2 3) returns true")
|
56
|
+
mock.should_receive(:xxx?).once.with(1, 2, 3).and_return(true)
|
57
|
+
assert_nothing_raised do
|
58
|
+
mock.should.be.xxx(1, 2, 3)
|
59
|
+
end
|
60
|
+
mock.__verify
|
61
|
+
end
|
62
|
+
|
63
|
+
# should.not.be.xxx
|
64
|
+
|
65
|
+
def test_should_not_be_xxx_should_raise_when_target_doesnt_understand_xxx
|
66
|
+
assert_raise(NoMethodError) do
|
67
|
+
5.should.not.be.xxx
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_should_not_be_xxx_should_raise_when_sending_xxx_to_target_returns_true
|
72
|
+
mock = Mock.new("xxx? returns true")
|
73
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(true)
|
74
|
+
assert_raise(ExpectationNotMetError) do
|
75
|
+
mock.should.not.be.xxx
|
76
|
+
end
|
77
|
+
mock.__verify
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_should_not_be_xxx_shouldnt_raise_when_sending_xxx_to_target_returns_nil
|
81
|
+
mock = Mock.new("xxx? returns nil")
|
82
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(nil)
|
83
|
+
assert_nothing_raised do
|
84
|
+
mock.should.not.be.xxx
|
85
|
+
end
|
86
|
+
mock.__verify
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_should_not_be_xxx_shouldnt_raise_when_sending_xxx_to_target_returns_false
|
90
|
+
mock = Mock.new("xxx? returns false")
|
91
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(false)
|
92
|
+
assert_nothing_raised do
|
93
|
+
mock.should.not.be.xxx
|
94
|
+
end
|
95
|
+
mock.__verify
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_should_not_be_xxx_should_raise_when_sending_xxx_to_target_returns_something_other_than_true_false_or_nil
|
99
|
+
mock = Mock.new("xxx? returns 5")
|
100
|
+
mock.should_receive(:xxx?).once.with_no_args.and_return(5)
|
101
|
+
assert_raise(ExpectationNotMetError) do
|
102
|
+
mock.should.not.be.xxx
|
103
|
+
end
|
104
|
+
mock.__verify
|
105
|
+
end
|
106
|
+
|
107
|
+
# should.be.xxx(args)
|
108
|
+
|
109
|
+
def test_should_not_be_xxx_with_args_passes_args_properly
|
110
|
+
mock = Mock.new("xxx?(1 2 3) returns false")
|
111
|
+
mock.should_receive(:xxx?).once.with(1, 2, 3).and_return(false)
|
112
|
+
assert_nothing_raised do
|
113
|
+
mock.should.not.be.xxx(1, 2, 3)
|
114
|
+
end
|
115
|
+
mock.__verify
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class ContainmentTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@dummy = 'dummy'
|
10
|
+
@equal_dummy = 'dummy'
|
11
|
+
@another_dummy = 'another_dummy'
|
12
|
+
@nil_var = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# should_include
|
16
|
+
|
17
|
+
def test_should_include_shouldnt_raise_when_string_inclusion_is_present
|
18
|
+
assert_nothing_raised do
|
19
|
+
@dummy.should.include "mm"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_include_should_raise_when_string_inclusion_is_missing
|
24
|
+
assert_raise(ExpectationNotMetError) do
|
25
|
+
@dummy.should.include "abc"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_should_include_shouldnt_raise_when_array_inclusion_is_present
|
30
|
+
assert_nothing_raised do
|
31
|
+
[1, 2, 3].should.include 2
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_include_should_raise_when_array_inclusion_is_missing
|
36
|
+
assert_raise(ExpectationNotMetError) do
|
37
|
+
[1, 2, 3].should.include 5
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_include_shouldnt_raise_when_hash_inclusion_is_present
|
42
|
+
assert_nothing_raised do
|
43
|
+
{"a"=>1}.should.include "a"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_include_should_raise_when_hash_inclusion_is_missing
|
48
|
+
assert_raise(ExpectationNotMetError) do
|
49
|
+
{"a"=>1}.should.include "b"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_should_include_shouldnt_raise_when_enumerable_inclusion_is_present
|
54
|
+
assert_nothing_raised do
|
55
|
+
IO.constants.should.include "SEEK_SET"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_should_include_should_raise_when_enumerable_inclusion_is_missing
|
60
|
+
assert_raise(ExpectationNotMetError) do
|
61
|
+
IO.constants.should.include "BLAH"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# should_not_include
|
66
|
+
|
67
|
+
def test_should_not_include_shouldnt_raise_when_string_inclusion_is_missing
|
68
|
+
assert_nothing_raised do
|
69
|
+
@dummy.should.not.include "abc"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_should_not_include_should_raise_when_string_inclusion_is_present
|
74
|
+
assert_raise(ExpectationNotMetError) do
|
75
|
+
@dummy.should.not.include "mm"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_should_not_include_shouldnt_raise_when_array_inclusion_is_missing
|
80
|
+
assert_nothing_raised do
|
81
|
+
[1, 2, 3].should.not.include 5
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_should_not_include_should_raise_when_array_inclusion_is_present
|
86
|
+
assert_raise(ExpectationNotMetError) do
|
87
|
+
[1, 2, 3].should.not.include 2
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_should_not_include_shouldnt_raise_when_hash_inclusion_is_missing
|
92
|
+
assert_nothing_raised do
|
93
|
+
{"a"=>1}.should.not.include "b"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_should_not_include_should_raise_when_hash_inclusion_is_present
|
98
|
+
assert_raise(ExpectationNotMetError) do
|
99
|
+
{"a"=>1}.should.not.include "a"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_should_not_include_shouldnt_raise_when_enumerable_inclusion_is_present
|
104
|
+
assert_nothing_raised do
|
105
|
+
IO.constants.should.not.include "BLAH"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_should_not_include_should_raise_when_enumerable_inclusion_is_missing
|
110
|
+
assert_raise(ExpectationNotMetError) do
|
111
|
+
IO.constants.should.not.include "SEEK_SET"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class EqualityTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@dummy = 'dummy'
|
10
|
+
@equal_dummy = 'dummy'
|
11
|
+
@another_dummy = 'another_dummy'
|
12
|
+
@nil_var = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# should.equal
|
16
|
+
|
17
|
+
def test_should_equal_should_not_raise_when_objects_are_equal
|
18
|
+
assert_nothing_raised do
|
19
|
+
@dummy.should.equal @equal_dummy
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_equal_should_raise_when_objects_are_not_equal
|
24
|
+
assert_raise(ExpectationNotMetError) do
|
25
|
+
@dummy.should.equal @another_dummy
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# should.not.equal
|
30
|
+
|
31
|
+
def test_should_not_equal_should_not_raise_when_objects_are_not_equal
|
32
|
+
assert_nothing_raised do
|
33
|
+
@dummy.should.not.equal @another_dummy
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_should_not_equal_should_raise_when_objects_are_not_equal
|
38
|
+
assert_raise(ExpectationNotMetError) do
|
39
|
+
@dummy.should.not.equal @equal_dummy
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class IdentityTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@dummy = 'dummy'
|
10
|
+
@equal_dummy = 'dummy'
|
11
|
+
@another_dummy = 'another_dummy'
|
12
|
+
@nil_var = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_be_same_as_should_not_raise_when_objects_are_same
|
16
|
+
assert_nothing_raised do
|
17
|
+
@dummy.should.be @dummy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_be_same_as_should_raise_when_objects_are_not_same
|
22
|
+
assert_raise(ExpectationNotMetError) do
|
23
|
+
@dummy.should.be @equal_dummy
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_be_nil_should_not_raise_when_object_is_nil
|
28
|
+
assert_nothing_raised do
|
29
|
+
@nil_var.should.be nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_be_nil_should_raise_when_object_is_not_nil
|
34
|
+
assert_raise(ExpectationNotMetError) do
|
35
|
+
@dummy.should.be nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# should.not.be
|
40
|
+
|
41
|
+
def test_should_not_be_same_as_should_not_raise_when_objects_are_not_same
|
42
|
+
assert_nothing_raised do
|
43
|
+
@dummy.should.not.be @equal_dummy
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_not_be_same_as_should_raise_when_objects_are_not_same
|
48
|
+
assert_raise(ExpectationNotMetError) do
|
49
|
+
@dummy.should.not.be @dummy
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_should_not_be_nil_should_not_raise_when_object_is_not_nil
|
54
|
+
assert_nothing_raised do
|
55
|
+
@dummy.should.not.be nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_should_not_be_nil_should_raise_when_object_is_nil
|
60
|
+
assert_raise(ExpectationNotMetError) do
|
61
|
+
@nil_var.should.not.be nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class RaisingTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# should.raise
|
9
|
+
|
10
|
+
def test_should_raise_should_pass_when_proper_exception_is_raised
|
11
|
+
assert_nothing_raised do
|
12
|
+
proc { ''.nonexistant_method }.should.raise NoMethodError
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_raise_should_fail_when_wrong_exception_is_raised
|
17
|
+
assert_raise(ExpectationNotMetError) do
|
18
|
+
proc { ''.nonexistant_method }.should.raise SyntaxError
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_raise_should_fail_when_no_exception_is_raised
|
23
|
+
assert_raise(ExpectationNotMetError) do
|
24
|
+
proc {''.to_s}.should.raise NoMethodError
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# should.not.raise
|
29
|
+
|
30
|
+
def test_should_not_raise_should_fail_when_specific_exception_is_raised
|
31
|
+
assert_raise(ExpectationNotMetError) do
|
32
|
+
proc { ''.nonexistant_method }.should.not.raise NoMethodError
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_should_not_raise_should_pass_when_other_exception_is_raised
|
37
|
+
assert_nothing_raised do
|
38
|
+
proc { ''.nonexistant_method }.should.not.raise SyntaxError
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_not_raise_should_pass_when_no_exception_is_raised
|
43
|
+
assert_nothing_raised do
|
44
|
+
proc { ''.to_s }.should.not.raise NoMethodError
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Api
|
5
|
+
module Helper
|
6
|
+
class RegexMatchingTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# should.match
|
9
|
+
|
10
|
+
def test_should_match_should_not_raise_when_objects_match
|
11
|
+
assert_nothing_raised do
|
12
|
+
"hi aslak".should.match /aslak/
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_equal_should_raise_when_objects_do_not_match
|
17
|
+
assert_raise(ExpectationNotMetError) do
|
18
|
+
"hi aslak".should.match /steve/
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# should.not.match
|
23
|
+
|
24
|
+
def test_should_not_match_should_not_raise_when_objects_do_not_match
|
25
|
+
assert_nothing_raised do
|
26
|
+
"hi aslak".should.not.match /steve/
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_not_match_should_raise_when_objects_match
|
31
|
+
assert_raise(ExpectationNotMetError) do
|
32
|
+
"hi aslak".should.not.match /aslak/
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|