assert 2.0.0.rc.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/{LICENSE → LICENSE.txt} +0 -0
- data/Rakefile +1 -3
- data/assert.gemspec +15 -15
- data/lib/assert.rb +1 -2
- data/lib/assert/assert_runner.rb +2 -1
- data/lib/assert/assertions.rb +153 -189
- data/lib/assert/version.rb +1 -1
- data/test/helper.rb +74 -51
- data/test/{fixtures → support}/inherited_stuff.rb +0 -0
- data/test/{test → system}/running_tests.rb +16 -43
- data/test/{assert_test.rb → unit/assert_tests.rb} +0 -0
- data/test/unit/assertions/assert_block_tests.rb +57 -0
- data/test/unit/assertions/assert_empty_tests.rb +58 -0
- data/test/unit/assertions/assert_equal_tests.rb +59 -0
- data/test/unit/assertions/assert_file_exists_tests.rb +59 -0
- data/test/unit/assertions/assert_includes_tests.rb +61 -0
- data/test/unit/assertions/assert_instance_of_tests.rb +61 -0
- data/test/unit/assertions/assert_kind_of_tests.rb +60 -0
- data/test/unit/assertions/assert_match_tests.rb +59 -0
- data/test/unit/assertions/assert_nil_tests.rb +59 -0
- data/test/unit/assertions/assert_raises_tests.rb +73 -0
- data/test/unit/assertions/assert_respond_to_tests.rb +63 -0
- data/test/unit/assertions/assert_same_tests.rb +65 -0
- data/test/unit/assertions_tests.rb +65 -0
- data/test/unit/context/basic_singleton_tests.rb +86 -0
- data/test/unit/context/setup_teardown_singleton_tests.rb +105 -0
- data/test/unit/context/test_should_singleton_tests.rb +134 -0
- data/test/{context_test.rb → unit/context_tests.rb} +53 -131
- data/test/{macro_test.rb → unit/macro_tests.rb} +15 -11
- data/test/{result_test.rb → unit/result_tests.rb} +27 -26
- data/test/{runner_test.rb → unit/runner_tests.rb} +1 -2
- data/test/{suite_test.rb → unit/suite_tests.rb} +63 -95
- data/test/{test_test.rb → unit/test_tests.rb} +45 -77
- data/test/{view/base_tests.rb → unit/view_tests.rb} +0 -1
- metadata +63 -104
- data/CHANGELOG.md +0 -33
- data/test/assertions/assert_block_test.rb +0 -39
- data/test/assertions/assert_empty_test.rb +0 -43
- data/test/assertions/assert_equal_test.rb +0 -43
- data/test/assertions/assert_file_exists_test.rb +0 -43
- data/test/assertions/assert_includes_test.rb +0 -44
- data/test/assertions/assert_instance_of_test.rb +0 -43
- data/test/assertions/assert_kind_of_test.rb +0 -43
- data/test/assertions/assert_match_test.rb +0 -43
- data/test/assertions/assert_nil_test.rb +0 -43
- data/test/assertions/assert_not_block_test.rb +0 -39
- data/test/assertions/assert_not_empty_test.rb +0 -43
- data/test/assertions/assert_not_equal_test.rb +0 -43
- data/test/assertions/assert_not_file_exists_test.rb +0 -43
- data/test/assertions/assert_not_included_test.rb +0 -44
- data/test/assertions/assert_not_instance_of_test.rb +0 -43
- data/test/assertions/assert_not_kind_of_test.rb +0 -43
- data/test/assertions/assert_not_match_test.rb +0 -43
- data/test/assertions/assert_not_nil_test.rb +0 -43
- data/test/assertions/assert_not_respond_to_test.rb +0 -43
- data/test/assertions/assert_not_same_test.rb +0 -45
- data/test/assertions/assert_nothing_raised_test.rb +0 -46
- data/test/assertions/assert_raises_test.rb +0 -49
- data/test/assertions/assert_respond_to_test.rb +0 -43
- data/test/assertions/assert_same_test.rb +0 -45
- data/test/assertions_test.rb +0 -60
- data/test/context/class_methods_test.rb +0 -531
- data/test/fixtures/sample_context.rb +0 -13
- data/test/fixtures/test_root/one_test.rb +0 -0
- data/test/fixtures/test_root/parent/area_one/area_test.rb +0 -0
- data/test/fixtures/test_root/shallow/deeply/nested_test.rb +0 -0
- data/test/fixtures/test_root/shallow/nested_test.rb +0 -0
- data/test/fixtures/test_root/shallow_test.rb +0 -0
- data/test/fixtures/test_root/two_test.rb +0 -0
- data/test/suite/context_info_test.rb +0 -42
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'assert'
|
2
|
+
require 'assert/assertions'
|
3
|
+
|
4
|
+
module Assert::Assertions
|
5
|
+
|
6
|
+
class AssertSameTest < Assert::Context
|
7
|
+
desc "the assert_same helper"
|
8
|
+
setup do
|
9
|
+
klass = Class.new; object = klass.new
|
10
|
+
desc = @desc = "assert same fail desc"
|
11
|
+
args = @args = [ object, klass.new, desc ]
|
12
|
+
@test = Factory.test do
|
13
|
+
assert_same(object, object) # pass
|
14
|
+
assert_same(*args) # fail
|
15
|
+
end
|
16
|
+
@test.run
|
17
|
+
end
|
18
|
+
subject{ @test }
|
19
|
+
|
20
|
+
should "produce results as expected" do
|
21
|
+
assert_equal 2, subject.result_count
|
22
|
+
assert_equal 1, subject.result_count(:pass)
|
23
|
+
assert_equal 1, subject.result_count(:fail)
|
24
|
+
end
|
25
|
+
|
26
|
+
should "have a fail message with custom and generic explanations" do
|
27
|
+
exp = "#{@args[2]}\n"\
|
28
|
+
"Expected #{@args[1].inspect} (#{@args[1].object_id})"\
|
29
|
+
" to be the same as #{@args[0].inspect} (#{@args[0].object_id})."
|
30
|
+
assert_equal exp, subject.fail_results.first.message
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class AssertNotSameTests < Assert::Context
|
36
|
+
desc "the assert_not_same helper"
|
37
|
+
setup do
|
38
|
+
klass = Class.new; object = klass.new
|
39
|
+
desc = @desc = "assert not same fail desc"
|
40
|
+
args = @args = [ object, object, desc ]
|
41
|
+
@test = Factory.test do
|
42
|
+
assert_not_same(*args) # fail
|
43
|
+
assert_not_same(object, klass.new) # pass
|
44
|
+
end
|
45
|
+
@test.run
|
46
|
+
end
|
47
|
+
subject{ @test }
|
48
|
+
|
49
|
+
should "produce results as expected" do
|
50
|
+
assert_equal 2, subject.result_count
|
51
|
+
assert_equal 1, subject.result_count(:pass)
|
52
|
+
assert_equal 1, subject.result_count(:fail)
|
53
|
+
end
|
54
|
+
|
55
|
+
should "have a fail message with custom and generic explanations" do
|
56
|
+
exp = "#{@args[2]}\n"\
|
57
|
+
"#{@args[1].inspect} (#{@args[1].object_id}) not expected"\
|
58
|
+
" to be the same as #{@args[0].inspect} (#{@args[0].object_id})."
|
59
|
+
assert_equal exp, subject.fail_results.first.message
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'assert'
|
2
|
+
require 'assert/assertions'
|
3
|
+
|
4
|
+
module Assert::Assertions
|
5
|
+
|
6
|
+
class BasicTests < Assert::Context
|
7
|
+
|
8
|
+
desc "An assert context"
|
9
|
+
setup do
|
10
|
+
@context_class = Factory.context_class
|
11
|
+
@context = @context_class.new
|
12
|
+
end
|
13
|
+
subject{ @context }
|
14
|
+
|
15
|
+
should have_imeths :assert_block, :assert_not_block, :refute_block
|
16
|
+
should have_imeths :assert_raises, :assert_not_raises
|
17
|
+
should have_imeths :assert_raise, :assert_not_raise, :assert_nothing_raised
|
18
|
+
should have_imeths :assert_kind_of, :assert_not_kind_of, :refute_kind_of
|
19
|
+
should have_imeths :assert_instance_of, :assert_not_instance_of, :refute_instance_of
|
20
|
+
should have_imeths :assert_respond_to, :assert_responds_to
|
21
|
+
should have_imeths :assert_not_respond_to, :assert_not_responds_to
|
22
|
+
should have_imeths :refute_respond_to, :refute_responds_to
|
23
|
+
should have_imeths :assert_same, :assert_not_same, :refute_same
|
24
|
+
should have_imeths :assert_equal, :assert_not_equal, :refute_equal
|
25
|
+
should have_imeths :assert_match, :assert_not_match, :assert_no_match, :refute_match
|
26
|
+
should have_imeths :assert_empty, :assert_not_empty, :refute_empty
|
27
|
+
should have_imeths :assert_includes, :assert_not_includes
|
28
|
+
should have_imeths :assert_included, :assert_not_included
|
29
|
+
should have_imeths :refute_includes, :refute_included
|
30
|
+
should have_imeths :assert_nil, :assert_not_nil, :refute_nil
|
31
|
+
should have_imeths :assert_file_exists, :assert_not_file_exists, :refute_file_exists
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class IgnoredTests < BasicTests
|
36
|
+
desc "ignored assertions helpers"
|
37
|
+
setup do
|
38
|
+
@tests = Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
|
39
|
+
context_info = Factory.context_info(@context_class)
|
40
|
+
Factory.test("ignored assertion helper #{helper}", context_info) do
|
41
|
+
self.send(helper, "doesn't matter")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
@expected_messages = Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
|
45
|
+
"The assertion `#{helper}` is not supported."\
|
46
|
+
" Please use another assertion or the basic `assert`."
|
47
|
+
end
|
48
|
+
@results = @tests.map(&:run).flatten
|
49
|
+
end
|
50
|
+
subject{ @results }
|
51
|
+
|
52
|
+
should "have an ignored result for each helper in the constant" do
|
53
|
+
subject.each do |result|
|
54
|
+
assert_kind_of Assert::Result::Ignore, result
|
55
|
+
end
|
56
|
+
assert_equal(Assert::Assertions::IGNORED_ASSERTION_HELPERS.size, subject.size)
|
57
|
+
end
|
58
|
+
|
59
|
+
should "have a custom ignore message for each helper in the constant" do
|
60
|
+
assert_equal(@expected_messages, subject.collect(&:message))
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'assert'
|
2
|
+
require 'assert/context'
|
3
|
+
|
4
|
+
class Assert::Context
|
5
|
+
|
6
|
+
# `ContextSingletonTests` defined in `test/helper.rb`
|
7
|
+
class BasicSingletonTests < ContextSingletonTests
|
8
|
+
should have_instance_methods :setup_once, :before_once, :startup
|
9
|
+
should have_instance_methods :teardown_once, :after_once, :shutdown
|
10
|
+
should have_instance_methods :setup, :before, :setups
|
11
|
+
should have_instance_methods :teardown, :after, :teardowns
|
12
|
+
should have_instance_methods :description, :desc, :describe, :subject
|
13
|
+
should have_instance_methods :test, :test_eventually, :test_skip
|
14
|
+
should have_instance_methods :should, :should_eventually, :should_skip
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class DescriptionsTests < BasicSingletonTests
|
19
|
+
desc "`descriptions` method"
|
20
|
+
setup do
|
21
|
+
descs = @descs = [ "something amazing", "it really is" ]
|
22
|
+
@context_class = Factory.context_class do
|
23
|
+
descs.each{ |text| desc text }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
should "return a collection containing any descriptions defined on the class" do
|
28
|
+
context_descs = subject.send :descriptions
|
29
|
+
assert_equal @descs, context_descs
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class DescriptionTests < BasicSingletonTests
|
35
|
+
desc "`description` method"
|
36
|
+
setup do
|
37
|
+
parent_text = @parent_desc = "parent description"
|
38
|
+
@parent_class = Factory.context_class do
|
39
|
+
desc parent_text
|
40
|
+
end
|
41
|
+
text = @desc = "and the description for this context"
|
42
|
+
@context_class = Factory.context_class(@parent_class) do
|
43
|
+
desc text
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
should "return a string of all the inherited descriptions" do
|
48
|
+
exp_desc = "parent description and the description for this context"
|
49
|
+
assert_equal exp_desc, @context_class.description
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class SubjectFromLocalTests < BasicSingletonTests
|
55
|
+
desc "subject method using local context"
|
56
|
+
setup do
|
57
|
+
subject_block = @subject_block = ::Proc.new{ @something }
|
58
|
+
@context_class = Factory.context_class do
|
59
|
+
subject(&subject_block)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
subject{ @subject_block }
|
63
|
+
|
64
|
+
should "set the subject block on the context class" do
|
65
|
+
assert_equal @context_class.subject, subject
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
class SubjectFromParentTests < BasicSingletonTests
|
71
|
+
desc "subject method using parent context"
|
72
|
+
setup do
|
73
|
+
parent_block = @parent_block = ::Proc.new{ @something }
|
74
|
+
@parent_class = Factory.context_class do
|
75
|
+
subject(&parent_block)
|
76
|
+
end
|
77
|
+
@context_class = Factory.context_class(@parent_class)
|
78
|
+
end
|
79
|
+
subject{ @parent_block }
|
80
|
+
|
81
|
+
should "default to it's parents subject block" do
|
82
|
+
assert_equal @context_class.subject, subject
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'assert'
|
2
|
+
require 'assert/context'
|
3
|
+
|
4
|
+
class Assert::Context
|
5
|
+
|
6
|
+
# `ContextSingletonTests` defined in `test/helper.rb`
|
7
|
+
class SetupTeardownSingletonTests < ContextSingletonTests
|
8
|
+
desc "setup and teardown"
|
9
|
+
end
|
10
|
+
|
11
|
+
class SetupTeardownOnceMethodsTests < SetupTeardownSingletonTests
|
12
|
+
desc "once methods"
|
13
|
+
setup do
|
14
|
+
block = @block = ::Proc.new{ something_once = true }
|
15
|
+
@context_class = Factory.context_class do
|
16
|
+
setup_once(&block)
|
17
|
+
teardown_once(&block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
teardown do
|
21
|
+
Assert.suite.send(:setups).reject!{ |b| b == @block }
|
22
|
+
end
|
23
|
+
|
24
|
+
should "add the block to the suite" do
|
25
|
+
assert_includes @block, Assert.suite.send(:setups)
|
26
|
+
assert_includes @block, Assert.suite.send(:teardowns)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
class SetupTeardownMethodsTests < SetupTeardownSingletonTests
|
32
|
+
desc "methods"
|
33
|
+
setup do
|
34
|
+
block = @block = ::Proc.new{ something = true }
|
35
|
+
@context_class = Factory.context_class do
|
36
|
+
setup(&block)
|
37
|
+
teardown(&block)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
should "add the block to the context" do
|
42
|
+
assert_includes @block, subject.send(:setups)
|
43
|
+
assert_includes @block, subject.send(:teardowns)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
class SetupTeardownWithMethodNameTests < SetupTeardownSingletonTests
|
49
|
+
desc "methods given a method name"
|
50
|
+
setup do
|
51
|
+
method_name = @method_name = :something_amazing
|
52
|
+
@context_class = Factory.context_class do
|
53
|
+
setup(method_name)
|
54
|
+
teardown(method_name)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
should "add the method name to the context" do
|
59
|
+
assert_includes @method_name, subject.send(:setups)
|
60
|
+
assert_includes @method_name, subject.send(:teardowns)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class SetupTeardownMultipleTests < SetupTeardownSingletonTests
|
66
|
+
desc "with multiple calls"
|
67
|
+
setup do
|
68
|
+
parent_setup_block = ::Proc.new{ self.setup_status = "the setup" }
|
69
|
+
parent_teardown_block = ::Proc.new{ self.teardown_status += "the teardown" }
|
70
|
+
@parent_class = Factory.context_class do
|
71
|
+
setup(&parent_setup_block)
|
72
|
+
teardown(&parent_teardown_block)
|
73
|
+
end
|
74
|
+
|
75
|
+
context_setup_block = ::Proc.new{ self.setup_status += " has been run" }
|
76
|
+
context_teardown_block = ::Proc.new{ self.teardown_status += "has been run " }
|
77
|
+
@context_class = Factory.context_class(@parent_class) do
|
78
|
+
setup(&context_setup_block)
|
79
|
+
setup(:setup_something)
|
80
|
+
teardown(:teardown_something)
|
81
|
+
teardown(&context_teardown_block)
|
82
|
+
end
|
83
|
+
|
84
|
+
@test_status_class = Class.new do
|
85
|
+
attr_accessor :setup_status, :teardown_status
|
86
|
+
define_method(:setup_something) do
|
87
|
+
self.setup_status += " with something"
|
88
|
+
end
|
89
|
+
define_method(:teardown_something) do
|
90
|
+
self.teardown_status = "with something "
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
should "run it's parent and it's own blocks in the correct order" do
|
96
|
+
subject.setup(obj = @test_status_class.new)
|
97
|
+
assert_equal "the setup has been run with something", obj.setup_status
|
98
|
+
|
99
|
+
subject.teardown(obj = @test_status_class.new)
|
100
|
+
assert_equal "with something has been run the teardown", obj.teardown_status
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'assert'
|
2
|
+
require 'assert/context'
|
3
|
+
|
4
|
+
class Assert::Context
|
5
|
+
|
6
|
+
# `ContextSingletonTests` defined in `test/helper.rb`
|
7
|
+
class TestShouldSingletonTests < ContextSingletonTests
|
8
|
+
desc "test and should methods"
|
9
|
+
setup do
|
10
|
+
@test_count_before = Assert.suite.tests.size
|
11
|
+
@test_desc = "be true"
|
12
|
+
@test_block = ::Proc.new{ assert(true) }
|
13
|
+
end
|
14
|
+
|
15
|
+
should "build a test using `test` with a desc and code block" do
|
16
|
+
d, b = @test_desc, @test_block
|
17
|
+
Factory.context_class { test(d, &b) }
|
18
|
+
|
19
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
20
|
+
|
21
|
+
exp_test_name = @test_desc
|
22
|
+
built_test = Assert.suite.tests.last
|
23
|
+
assert_kind_of Assert::Test, built_test
|
24
|
+
assert_equal exp_test_name, built_test.name
|
25
|
+
assert_equal @test_block, built_test.code
|
26
|
+
end
|
27
|
+
|
28
|
+
should "build a test using `should` with a desc and code block" do
|
29
|
+
d, b = @test_desc, @test_block
|
30
|
+
Factory.context_class { should(d, &b) }
|
31
|
+
|
32
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
33
|
+
|
34
|
+
exp_test_name = "should #{@test_desc}"
|
35
|
+
built_test = Assert.suite.tests.last
|
36
|
+
assert_kind_of Assert::Test, built_test
|
37
|
+
assert_equal exp_test_name, built_test.name
|
38
|
+
assert_equal @test_block, built_test.code
|
39
|
+
end
|
40
|
+
|
41
|
+
should "build a test that skips when `test` called with no block" do
|
42
|
+
d = @test_desc
|
43
|
+
context_class = Factory.context_class { test(d) }
|
44
|
+
context_info = Factory.context_info(context_class)
|
45
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
46
|
+
|
47
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
48
|
+
assert_raises(Assert::Result::TestSkipped) do
|
49
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
should "build a test that skips when `should` called with no block" do
|
54
|
+
d = @test_desc
|
55
|
+
context_class = Factory.context_class { should(d) }
|
56
|
+
context_info = Factory.context_info(context_class)
|
57
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
58
|
+
|
59
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
60
|
+
assert_raises(Assert::Result::TestSkipped) do
|
61
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
should "build a test that skips when `test_eventually` called" do
|
66
|
+
d, b = @test_desc, @test_block
|
67
|
+
context_class = Factory.context_class { test_eventually(d, &b) }
|
68
|
+
context_info = Factory.context_info(context_class)
|
69
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
70
|
+
|
71
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
72
|
+
assert_raises(Assert::Result::TestSkipped) do
|
73
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
should "build a test that skips when `should_eventually` called" do
|
78
|
+
d, b = @test_desc, @test_block
|
79
|
+
context_class = Factory.context_class { should_eventually(d, &b) }
|
80
|
+
context_info = Factory.context_info(context_class)
|
81
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
82
|
+
|
83
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
84
|
+
assert_raises(Assert::Result::TestSkipped) do
|
85
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
should "build a test from a macro using `test`" do
|
90
|
+
d, b = @test_desc, @test_block
|
91
|
+
m = Assert::Macro.new{ test(d, &b); test(d, &b) }
|
92
|
+
Factory.context_class { test(m) }
|
93
|
+
|
94
|
+
assert_equal @test_count_before+2, Assert.suite.tests.size
|
95
|
+
end
|
96
|
+
|
97
|
+
should "build a test from a macro using `should`" do
|
98
|
+
d, b = @test_desc, @test_block
|
99
|
+
m = Assert::Macro.new{ should(d, &b); should(d, &b) }
|
100
|
+
Factory.context_class { should(m) }
|
101
|
+
|
102
|
+
assert_equal @test_count_before+2, Assert.suite.tests.size
|
103
|
+
end
|
104
|
+
|
105
|
+
should "build a test that skips from a macro using `test_eventually`" do
|
106
|
+
d, b = @test_desc, @test_block
|
107
|
+
m = Assert::Macro.new{ test(d, &b); test(d, &b) }
|
108
|
+
context_class = Factory.context_class { test_eventually(m) }
|
109
|
+
context_info = Factory.context_info(context_class)
|
110
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
111
|
+
|
112
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
113
|
+
assert_raises(Assert::Result::TestSkipped) do
|
114
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
should "build a test that skips from a macro using `should_eventually`" do
|
119
|
+
d, b = @test_desc, @test_block
|
120
|
+
m = Assert::Macro.new{ should(d, &b); should(d, &b) }
|
121
|
+
context_class = Factory.context_class { should_eventually(m) }
|
122
|
+
context_info = Factory.context_info(context_class)
|
123
|
+
context = context_class.new(Factory.test("whatever", context_info))
|
124
|
+
|
125
|
+
assert_equal @test_count_before+1, Assert.suite.tests.size
|
126
|
+
assert_raises(Assert::Result::TestSkipped) do
|
127
|
+
context.instance_eval(&Assert.suite.tests.last.code)
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|