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
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
module Spec
|
3
|
+
module Runner
|
4
|
+
class BacktraceTweakerTest < Test::Unit::TestCase
|
5
|
+
def test_should_not_barf_on_nil_backtrace
|
6
|
+
error = RuntimeError.new
|
7
|
+
tweaker = BacktraceTweaker.new
|
8
|
+
proc { tweaker.tweak_backtrace error, 'spec name' }.should.not.raise
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_remove___instance_exec
|
12
|
+
error = RuntimeError.new
|
13
|
+
error.set_backtrace ["./examples/airport_spec.rb:28:in `__instance_exec_1014688_1661744'"]
|
14
|
+
tweaker = BacktraceTweaker.new
|
15
|
+
tweaker.tweak_backtrace error, 'spec name'
|
16
|
+
error.backtrace[0].should.equal "./examples/airport_spec.rb:28:in `spec name'"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
module Spec
|
3
|
+
module Runner
|
4
|
+
class ContextRunnerTest < Test::Unit::TestCase
|
5
|
+
def test_should_call_run_doc_on_context
|
6
|
+
context1 = Api::Mock.new "context1"
|
7
|
+
context2 = Api::Mock.new "context2"
|
8
|
+
context1.should_receive(:run_docs)
|
9
|
+
context2.should_receive(:run_docs)
|
10
|
+
runner = ContextRunner.new ["-d"]
|
11
|
+
runner.add_context context1
|
12
|
+
runner.add_context context2
|
13
|
+
runner.run
|
14
|
+
context1.__verify
|
15
|
+
context2.__verify
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Runner
|
5
|
+
class ContextTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@listener = Api::Mock.new "listener"
|
9
|
+
@context = Context.new("context") {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_add_itself_to_listener_on_run
|
13
|
+
@listener.should_receive(:add_context).with "context"
|
14
|
+
@context.run(@listener)
|
15
|
+
@listener.__verify
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_add_itself_to_listener_on_run_docs
|
19
|
+
@listener.should_receive(:add_context).with "context"
|
20
|
+
@context.run_docs(@listener)
|
21
|
+
@listener.__verify
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_should_execute_setup_from_inherited_context
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
module Spec
|
3
|
+
module Runner
|
4
|
+
class ExecutionContextTest < Test::Unit::TestCase
|
5
|
+
def test_should_add_new_mock_to_spec_when_mock_message_received
|
6
|
+
spec = Api::Mock.new "spec"
|
7
|
+
spec.should_receive(:add_mock) {|mock| mock.should.be.instance.of Api::Mock}
|
8
|
+
ec = ExecutionContext.new spec
|
9
|
+
mock = ec.mock("a mock")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Spec
|
5
|
+
module Runner
|
6
|
+
class OptionParserTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_verbose_should_be_true_by_default
|
9
|
+
options = OptionParser.parse([])
|
10
|
+
assert(!options.verbose)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_out_should_be_stdout_by_default
|
14
|
+
options = OptionParser.parse([])
|
15
|
+
assert_equal(STDOUT, options.out)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_verbose_should_be_settable_with_v
|
19
|
+
options = OptionParser.parse(["-v"])
|
20
|
+
assert(options.verbose)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_verbose_should_be_settable_with_verbose
|
24
|
+
options = OptionParser.parse(["--verbose"])
|
25
|
+
assert(options.verbose)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_doc_should_be_false_by_default
|
29
|
+
options = OptionParser.parse([])
|
30
|
+
assert(!options.doc)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_doc_should_be_settable_with_d
|
34
|
+
options = OptionParser.parse(["-d"])
|
35
|
+
assert(options.doc)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_out_should_be_settable_with_o
|
39
|
+
options = OptionParser.parse(["-o","test.txt"])
|
40
|
+
assert_equal("test.txt", options.out)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_out_should_be_settable_with_of
|
44
|
+
options = OptionParser.parse(["--of","test.txt"])
|
45
|
+
assert_equal("test.txt", options.out)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
module Spec
|
3
|
+
module Runner
|
4
|
+
class RDocFormatterTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@io = StringIO.new
|
8
|
+
@formatter = RDocFormatter.new(@io)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_push_out_context
|
12
|
+
@formatter.add_context("context")
|
13
|
+
assert_equal("# context\n", @io.string)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_push_out_spec
|
17
|
+
@formatter.add_spec("spec")
|
18
|
+
assert_equal("# * spec\n", @io.string)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Spec
|
5
|
+
module Runner
|
6
|
+
class SimpleTextReporterTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@io = StringIO.new
|
10
|
+
@backtrace_tweaker = Spec::Api::Mock.new("backtrace tweaker")
|
11
|
+
@reporter = SimpleTextReporter.new(@io, false, @backtrace_tweaker)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_include_time
|
15
|
+
@reporter.start
|
16
|
+
@reporter.end
|
17
|
+
@reporter.dump
|
18
|
+
assert_match(/Finished in [0-9].[0-9|e|-]+ seconds/, @io.string)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_output_stats_even_with_no_data
|
22
|
+
@reporter.dump
|
23
|
+
assert_match(/Finished in 0.0 seconds/, @io.string)
|
24
|
+
assert_match(/0 contexts, 0 specifications, 0 failures/, @io.string)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_account_for_context_in_stats_for_pass
|
28
|
+
@reporter.add_context Context.new("context") {}
|
29
|
+
@reporter.dump
|
30
|
+
assert_match(/1 context, 0 specifications, 0 failures/, @io.string)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_account_for_spec_in_stats_for_pass
|
34
|
+
@reporter.add_spec Specification.new("spec") {}
|
35
|
+
@reporter.dump
|
36
|
+
assert_match(/0 contexts, 1 specification, 0 failures/, @io.string)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_should_account_for_spec_and_error_in_stats_for_pass
|
40
|
+
@backtrace_tweaker.should_receive(:tweak_backtrace)
|
41
|
+
@reporter.add_spec Specification.new("spec"), [RuntimeError.new]
|
42
|
+
@reporter.dump
|
43
|
+
assert_match(/0 contexts, 1 specification, 1 failure/, @io.string)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_handle_multiple_contexts_same_name
|
47
|
+
@reporter.add_context Context.new("context") {}
|
48
|
+
@reporter.add_context Context.new("context") {}
|
49
|
+
@reporter.add_context Context.new("context") {}
|
50
|
+
@reporter.dump
|
51
|
+
assert_match(/3 contexts, 0 specifications, 0 failures/, @io.string)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_should_handle_multiple_specs_same_name
|
55
|
+
@backtrace_tweaker.should_receive(:tweak_backtrace)
|
56
|
+
@reporter.add_context Context.new("context") {}
|
57
|
+
@reporter.add_spec Specification.new("spec") {}
|
58
|
+
@reporter.add_spec Specification.new("spec"), [RuntimeError.new]
|
59
|
+
@reporter.add_context Context.new("context") {}
|
60
|
+
@reporter.add_spec Specification.new("spec") {}
|
61
|
+
@reporter.add_spec Specification.new("spec"), [RuntimeError.new]
|
62
|
+
@reporter.dump
|
63
|
+
assert_match(/2 contexts, 4 specifications, 2 failures/, @io.string)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_should_delegate_to_backtrace_tweaker
|
67
|
+
@backtrace_tweaker.should_receive(:tweak_backtrace)
|
68
|
+
@reporter.add_spec Specification.new("spec"), [RuntimeError.new]
|
69
|
+
@backtrace_tweaker.__verify
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
class SimpleTextReporterQuietOutputTest < Test::Unit::TestCase
|
75
|
+
|
76
|
+
def setup
|
77
|
+
@io = StringIO.new
|
78
|
+
@reporter = SimpleTextReporter.new(@io)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_should_remain_silent_when_context_name_provided
|
82
|
+
@reporter.add_context "context"
|
83
|
+
assert_equal("\n", @io.string)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_should_output_dot_when_spec_passed
|
87
|
+
@reporter.add_spec "spec"
|
88
|
+
assert_equal(".", @io.string)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_should_output_F_when_spec_failed
|
92
|
+
@reporter.add_spec "spec", [RuntimeError.new]
|
93
|
+
assert_equal("F", @io.string)
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
class SimpleTextReporterVerboseOutputTest < Test::Unit::TestCase
|
100
|
+
|
101
|
+
def setup
|
102
|
+
@io = StringIO.new
|
103
|
+
@reporter = SimpleTextReporter.new(@io, true)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_should_output_when_context_name_provided
|
107
|
+
@reporter.add_context "context"
|
108
|
+
assert_equal("\ncontext\n", @io.string)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_should_output_spec_name_when_spec_passed
|
112
|
+
@reporter.add_spec "spec"
|
113
|
+
assert_equal("- spec\n", @io.string)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_should_output_failure_when_spec_failed
|
117
|
+
error = RuntimeError.new
|
118
|
+
begin
|
119
|
+
raise error
|
120
|
+
rescue
|
121
|
+
end
|
122
|
+
@reporter.add_spec "spec", [error]
|
123
|
+
assert_equal("- spec (FAILED)\n#{error.message} (#{error.class.name})\n#{error.backtrace.join("\n")}\n", @io.string)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
module Spec
|
3
|
+
module Runner
|
4
|
+
class SpecificationTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@reporter = Api::Mock.new "reporter"
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_should_run_spec_in_scope_of_execution_context
|
11
|
+
spec = Specification.new("should pass") do
|
12
|
+
self.should.not.be.instance_of Specification
|
13
|
+
self.should.be.instance_of ExecutionContext
|
14
|
+
end
|
15
|
+
@reporter.should_receive(:add_spec).with "should pass", []
|
16
|
+
spec.run @reporter
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_add_itself_to_reporter_when_passes
|
20
|
+
spec = Specification.new("spec") {}
|
21
|
+
@reporter.should_receive(:add_spec).with "spec", []
|
22
|
+
spec.run(@reporter)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_should_add_itself_to_reporter_when_fails
|
26
|
+
error = RuntimeError.new
|
27
|
+
spec = Specification.new("spec") { raise error }
|
28
|
+
@reporter.should_receive(:add_spec).with "spec", [error]
|
29
|
+
spec.run(@reporter)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_should_add_itself_to_reporter_when_calling_run_docs
|
33
|
+
spec = Specification.new("spec") {}
|
34
|
+
@reporter.should_receive(:add_spec).with "spec"
|
35
|
+
spec.run_docs(@reporter)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_should_verify_mocks_after_teardown
|
39
|
+
spec = Specification.new("spec") do
|
40
|
+
mock = mock("a mock")
|
41
|
+
mock.should_receive(:poke)
|
42
|
+
end
|
43
|
+
@reporter.should_receive(:add_spec) do |spec_name, errors|
|
44
|
+
spec_name.should.equal "spec"
|
45
|
+
errors[0].message.should.match /expected poke once, but received it 0 times/
|
46
|
+
end
|
47
|
+
spec.run @reporter
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_should_run_teardown_even_when_main_block_fails
|
51
|
+
spec = Specification.new("spec") do
|
52
|
+
raise "in body"
|
53
|
+
end
|
54
|
+
teardown = lambda do
|
55
|
+
raise "in teardown"
|
56
|
+
end
|
57
|
+
@reporter.should_receive(:add_spec) do |spec, errors|
|
58
|
+
errors.length.should.equal 2
|
59
|
+
errors[0].message.should.equal "in body"
|
60
|
+
errors[1].message.should.equal "in teardown"
|
61
|
+
end
|
62
|
+
spec.run @reporter, nil, teardown
|
63
|
+
end
|
64
|
+
|
65
|
+
def teardown
|
66
|
+
@reporter.__verify
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
require 'spec/tool/command_line'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
module Spec
|
6
|
+
module Tool
|
7
|
+
class CommandLineTest < Test::Unit::TestCase
|
8
|
+
def test_writes_translated_file
|
9
|
+
translator = Api::Mock.new "translator"
|
10
|
+
filesystem = Api::Mock.new "filesystem"
|
11
|
+
filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_translator_test.rb", "spec/test_unit_translator_test.rb"
|
12
|
+
filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_test.rb", "spec/test_unit_api_test.rb"
|
13
|
+
filesystem.should_receive(:write_translation).with "./test/spec/tool/test_unit_api_spec.rb", "spec/test_unit_api_spec.rb"
|
14
|
+
filesystem.should_receive(:write_translation).with "./test/spec/tool/command_line_test.rb", "spec/command_line_test.rb"
|
15
|
+
|
16
|
+
cl = CommandLine.new(filesystem)
|
17
|
+
out = StringIO.new
|
18
|
+
cl.run(File.dirname(__FILE__), "spec", out)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec'
|
2
|
+
|
3
|
+
module Spec
|
4
|
+
module Tool
|
5
|
+
context "TestUnitApi" do
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@an_int = 789
|
9
|
+
end
|
10
|
+
|
11
|
+
teardown do
|
12
|
+
end
|
13
|
+
|
14
|
+
specify "Can be translated to rspec" do
|
15
|
+
a_float = 123.45
|
16
|
+
a_nil = nil
|
17
|
+
|
18
|
+
@an_int.should.not.be nil
|
19
|
+
lambda { true }.should.be true
|
20
|
+
lambda do
|
21
|
+
true
|
22
|
+
end.should.be true
|
23
|
+
@an_int.should.equal 789
|
24
|
+
a_float.should.be.close 123.5, 0.1
|
25
|
+
@an_int.should.be.instance.of Fixnum
|
26
|
+
@an_int.should.be.kind.of Numeric
|
27
|
+
@an_int.to_s.should.match /789/
|
28
|
+
a_nil.should.be nil
|
29
|
+
@an_int.to_s.should.not.match /7890/
|
30
|
+
@an_int.should.not.equal 780
|
31
|
+
@an_int.should.not.be nil
|
32
|
+
a_float.should.not.be @an_int
|
33
|
+
lambda { foo = 1 }.should.not.raise
|
34
|
+
lambda do
|
35
|
+
foo = 2
|
36
|
+
end.should.not.raise
|
37
|
+
lambda { foo = 3 }.should.not.throw
|
38
|
+
lambda do
|
39
|
+
foo = 4
|
40
|
+
end.should.not.throw
|
41
|
+
#assert_operator object1, operator, object2, "a message"
|
42
|
+
lambda { raise NotImplementedError }.should.raise NotImplementedError
|
43
|
+
lambda do
|
44
|
+
raise NotImplementedError
|
45
|
+
end.should.raise NotImplementedError
|
46
|
+
lambda { raise NotImplementedError }.should.raise NotImplementedError
|
47
|
+
lambda do
|
48
|
+
raise NotImplementedError
|
49
|
+
end.should.raise NotImplementedError
|
50
|
+
@an_int.should.respond.to :to_f
|
51
|
+
a_float.should.be a_float
|
52
|
+
#assert_send send_array, "a message"
|
53
|
+
lambda { throw :foo }.should.throw :foo
|
54
|
+
lambda do
|
55
|
+
throw :foo
|
56
|
+
end.should.throw :foo
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|