assert 2.18.2 → 2.18.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -6
  3. data/assert.gemspec +1 -1
  4. data/lib/assert/actual_value.rb +127 -0
  5. data/lib/assert/assertions.rb +11 -20
  6. data/lib/assert/context.rb +13 -5
  7. data/lib/assert/context/let_dsl.rb +13 -0
  8. data/lib/assert/context/method_missing.rb +19 -0
  9. data/lib/assert/macros/methods.rb +4 -4
  10. data/lib/assert/stub.rb +4 -0
  11. data/lib/assert/version.rb +1 -1
  12. data/test/helper.rb +23 -25
  13. data/test/support/factory.rb +15 -0
  14. data/test/system/stub_tests.rb +348 -333
  15. data/test/system/test_tests.rb +111 -109
  16. data/test/unit/actual_value_tests.rb +335 -0
  17. data/test/unit/assert_tests.rb +84 -59
  18. data/test/unit/assertions/assert_block_tests.rb +32 -31
  19. data/test/unit/assertions/assert_empty_tests.rb +35 -32
  20. data/test/unit/assertions/assert_equal_tests.rb +81 -75
  21. data/test/unit/assertions/assert_file_exists_tests.rb +34 -33
  22. data/test/unit/assertions/assert_includes_tests.rb +40 -37
  23. data/test/unit/assertions/assert_instance_of_tests.rb +36 -33
  24. data/test/unit/assertions/assert_kind_of_tests.rb +36 -33
  25. data/test/unit/assertions/assert_match_tests.rb +36 -33
  26. data/test/unit/assertions/assert_nil_tests.rb +32 -31
  27. data/test/unit/assertions/assert_raises_tests.rb +55 -55
  28. data/test/unit/assertions/assert_respond_to_tests.rb +38 -35
  29. data/test/unit/assertions/assert_same_tests.rb +91 -80
  30. data/test/unit/assertions/assert_true_false_tests.rb +64 -60
  31. data/test/unit/assertions_tests.rb +15 -13
  32. data/test/unit/config_helpers_tests.rb +36 -35
  33. data/test/unit/config_tests.rb +33 -34
  34. data/test/unit/context/let_dsl_tests.rb +10 -0
  35. data/test/unit/context/setup_dsl_tests.rb +70 -81
  36. data/test/unit/context/subject_dsl_tests.rb +16 -43
  37. data/test/unit/context/suite_dsl_tests.rb +16 -16
  38. data/test/unit/context/test_dsl_tests.rb +50 -54
  39. data/test/unit/context_info_tests.rb +16 -15
  40. data/test/unit/context_tests.rb +170 -157
  41. data/test/unit/default_runner_tests.rb +2 -5
  42. data/test/unit/default_suite_tests.rb +51 -53
  43. data/test/unit/factory_tests.rb +3 -3
  44. data/test/unit/file_line_tests.rb +31 -33
  45. data/test/unit/macro_tests.rb +9 -10
  46. data/test/unit/result_tests.rb +150 -163
  47. data/test/unit/runner_tests.rb +63 -63
  48. data/test/unit/suite_tests.rb +57 -54
  49. data/test/unit/test_tests.rb +134 -126
  50. data/test/unit/utils_tests.rb +41 -45
  51. data/test/unit/view_helpers_tests.rb +55 -52
  52. data/test/unit/view_tests.rb +20 -22
  53. metadata +11 -4
@@ -8,27 +8,28 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_nil`"
11
- setup do
12
- desc = @desc = "assert nil empty fail desc"
13
- args = @args = [1, desc]
14
- @test = Factory.test do
11
+ subject { test1 }
12
+
13
+ let(:desc1) { "assert nil empty fail desc" }
14
+ let(:args1) { [1, desc1] }
15
+ let(:test1) {
16
+ args = args1
17
+ Factory.test do
15
18
  assert_nil(nil) # pass
16
19
  assert_nil(*args) # fail
17
20
  end
18
- @c = @test.config
19
- @test.run(&test_run_callback)
20
- end
21
- subject{ @test }
21
+ }
22
+ let(:config1) { test1.config }
22
23
 
23
24
  should "produce results as expected" do
24
- assert_equal 2, test_run_result_count
25
- assert_equal 1, test_run_result_count(:pass)
26
- assert_equal 1, test_run_result_count(:fail)
27
- end
25
+ subject.run(&test_run_callback)
28
26
 
29
- should "have a fail message with custom and generic explanations" do
30
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to be nil."
31
- assert_equal exp, test_run_results(:fail).first.message
27
+ assert_that(test_run_result_count).equals(2)
28
+ assert_that(test_run_result_count(:pass)).equals(1)
29
+ assert_that(test_run_result_count(:fail)).equals(1)
30
+
31
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be nil."
32
+ assert_that(test_run_results(:fail).first.message).equals(exp)
32
33
  end
33
34
  end
34
35
 
@@ -36,28 +37,28 @@ module Assert::Assertions
36
37
  include Assert::Test::TestHelpers
37
38
 
38
39
  desc "`assert_not_nil`"
39
- setup do
40
- desc = @desc = "assert not nil empty fail desc"
41
- args = @args = [nil, desc]
42
- @test = Factory.test do
40
+ subject { test1 }
41
+
42
+ let(:desc1) { "assert not nil empty fail desc" }
43
+ let(:args1) { [nil, desc1] }
44
+ let(:test1) {
45
+ args = args1
46
+ Factory.test do
43
47
  assert_not_nil(1) # pass
44
48
  assert_not_nil(*args) # fail
45
49
  end
46
- @c = @test.config
47
- @test.run(&test_run_callback)
48
- end
49
- subject{ @test }
50
+ }
51
+ let(:config1) { test1.config }
50
52
 
51
53
  should "produce results as expected" do
52
- assert_equal 2, test_run_result_count
53
- assert_equal 1, test_run_result_count(:pass)
54
- assert_equal 1, test_run_result_count(:fail)
55
- end
54
+ subject.run(&test_run_callback)
56
55
 
57
- should "have a fail message with custom and generic explanations" do
58
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be nil."
59
- assert_equal exp, test_run_results(:fail).first.message
56
+ assert_that(test_run_result_count).equals(2)
57
+ assert_that(test_run_result_count(:pass)).equals(1)
58
+ assert_that(test_run_result_count(:fail)).equals(1)
59
+
60
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be nil."
61
+ assert_that(test_run_results(:fail).first.message).equals(exp)
60
62
  end
61
63
  end
62
64
  end
63
-
@@ -6,54 +6,55 @@ module Assert::Assertions
6
6
  include Assert::Test::TestHelpers
7
7
 
8
8
  desc "`assert_raises`"
9
- setup do
10
- d = @d = "assert raises fail desc"
11
- @test = Factory.test do
12
- assert_raises(StandardError, RuntimeError){ raise(StandardError) } # pass
13
- assert_raises(StandardError, RuntimeError, d){ raise(Exception) } # fail
14
- assert_raises(RuntimeError, d){ raise(StandardError) } # fail
15
- assert_raises(RuntimeError, d){ true } # fail
16
- assert_raises(d){ true } # fail
9
+ subject { test1 }
10
+
11
+ let(:desc1) { "assert raises fail desc" }
12
+ let(:test1) {
13
+ desc = desc1
14
+ Factory.test do
15
+ assert_raises(StandardError, RuntimeError) { raise(StandardError) } # pass
16
+ assert_raises(StandardError, RuntimeError, desc) { raise(Exception) } # fail
17
+ assert_raises(RuntimeError, desc) { raise(StandardError) } # fail
18
+ assert_raises(RuntimeError, desc) { true } # fail
19
+ assert_raises(desc) { true } # fail
17
20
  end
18
- @test.run(&test_run_callback)
19
- end
20
- subject{ @test }
21
+ }
21
22
 
22
23
  should "produce results as expected" do
23
- assert_equal 5, test_run_result_count
24
- assert_equal 1, test_run_result_count(:pass)
25
- assert_equal 4, test_run_result_count(:fail)
26
- end
24
+ subject.run(&test_run_callback)
27
25
 
28
- should "have a fail message with custom and generic explanations" do
29
- exp = [
30
- "#{@d}\nStandardError or RuntimeError exception expected, not:",
31
- "#{@d}\nRuntimeError exception expected, not:",
32
- "#{@d}\nRuntimeError exception expected but nothing raised.",
33
- "#{@d}\nAn exception expected but nothing raised."
34
- ]
26
+ assert_that(test_run_result_count).equals(5)
27
+ assert_that(test_run_result_count(:pass)).equals(1)
28
+ assert_that(test_run_result_count(:fail)).equals(4)
29
+
30
+ exp =
31
+ [ "#{desc1}\nStandardError or RuntimeError exception expected, not:",
32
+ "#{desc1}\nRuntimeError exception expected, not:",
33
+ "#{desc1}\nRuntimeError exception expected but nothing raised.",
34
+ "#{desc1}\nAn exception expected but nothing raised."
35
+ ]
35
36
  messages = test_run_results(:fail).map(&:message)
36
- messages.each_with_index{ |msg, n| assert_match(/^#{exp[n]}/, msg) }
37
+ messages.each_with_index{ |msg, n| assert_that(msg).matches(/^#{exp[n]}/) }
37
38
  end
38
39
 
39
40
  should "return any raised exception instance" do
40
41
  error = nil
41
42
  error_msg = Factory.string
42
- test = Factory.test do
43
- error = assert_raises(RuntimeError){ raise(RuntimeError, error_msg) }
44
- end
43
+
44
+ test =
45
+ Factory.test do
46
+ error = assert_raises(RuntimeError) { raise(RuntimeError, error_msg) }
47
+ end
45
48
  test.run
46
49
 
47
- assert_not_nil error
48
- assert_kind_of RuntimeError, error
49
- assert_equal error_msg, error.message
50
+ assert_that(error).is_not_nil
51
+ assert_that(error).is_kind_of(RuntimeError)
52
+ assert_that(error.message).equals(error_msg)
50
53
 
51
- test = Factory.test do
52
- error = assert_raises(RuntimeError){ }
53
- end
54
+ test = Factory.test { error = assert_raises(RuntimeError) {} }
54
55
  test.run
55
56
 
56
- assert_nil error
57
+ assert_that(error).is_nil
57
58
  end
58
59
  end
59
60
 
@@ -61,33 +62,32 @@ module Assert::Assertions
61
62
  include Assert::Test::TestHelpers
62
63
 
63
64
  desc "`assert_nothing_raised`"
64
- setup do
65
- d = @d = "assert nothing raised fail desc"
66
- @test = Factory.test do
67
- anr = :assert_nothing_raised
68
- self.send(anr, StandardError, RuntimeError, d){ raise(StandardError) } # fail
69
- self.send(anr, RuntimeError){ raise(StandardError) } # pass
70
- self.send(anr, d){ raise(RuntimeError) } # fail
71
- self.send(anr){ true } # pass
65
+ subject { test1 }
66
+
67
+ let(:desc1) { "assert nothing raised fail desc" }
68
+ let(:test1) {
69
+ desc = desc1
70
+ Factory.test do
71
+ assert_nothing_raised(StandardError, RuntimeError, desc) { raise(StandardError) } # fail
72
+ assert_nothing_raised(RuntimeError) { raise(StandardError) } # pass
73
+ assert_nothing_raised(desc) { raise(RuntimeError) } # fail
74
+ assert_nothing_raised { true } # pass
72
75
  end
73
- @test.run(&test_run_callback)
74
- end
75
- subject{ @test }
76
+ }
76
77
 
77
78
  should "produce results as expected" do
78
- assert_equal 4, test_run_result_count
79
- assert_equal 2, test_run_result_count(:pass)
80
- assert_equal 2, test_run_result_count(:fail)
81
- end
79
+ subject.run(&test_run_callback)
80
+
81
+ assert_that(test_run_result_count).equals(4)
82
+ assert_that(test_run_result_count(:pass)).equals(2)
83
+ assert_that(test_run_result_count(:fail)).equals(2)
82
84
 
83
- should "have a fail message with custom and generic explanations" do
84
- exp = [
85
- "#{@d}\nStandardError or RuntimeError exception not expected, but raised:",
86
- "#{@d}\nAn exception not expected, but raised:"
87
- ]
85
+ exp =
86
+ [ "#{desc1}\nStandardError or RuntimeError exception not expected, but raised:",
87
+ "#{desc1}\nAn exception not expected, but raised:"
88
+ ]
88
89
  messages = test_run_results(:fail).map(&:message)
89
- messages.each_with_index{ |msg, n| assert_match(/^#{exp[n]}/, msg) }
90
+ messages.each_with_index{ |msg, n| assert_that(msg).matches(/^#{exp[n]}/) }
90
91
  end
91
92
  end
92
93
  end
93
-
@@ -8,29 +8,31 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_respond_to`"
11
- setup do
12
- desc = @desc = "assert respond to fail desc"
13
- args = @args = [:abs, "1", desc]
14
- @test = Factory.test do
11
+ subject { test1 }
12
+
13
+ let(:desc1) { "assert respond to fail desc" }
14
+ let(:args1) { [:abs, "1", desc1] }
15
+ let(:test1) {
16
+ args = args1
17
+ Factory.test do
15
18
  assert_respond_to(:abs, 1) # pass
16
19
  assert_respond_to(*args) # fail
17
20
  end
18
- @c = @test.config
19
- @test.run(&test_run_callback)
20
- end
21
- subject{ @test }
21
+ }
22
+ let(:config1) { test1.config }
22
23
 
23
24
  should "produce results as expected" do
24
- assert_equal 2, test_run_result_count
25
- assert_equal 1, test_run_result_count(:pass)
26
- assert_equal 1, test_run_result_count(:fail)
27
- end
25
+ subject.run(&test_run_callback)
28
26
 
29
- should "have a fail message with custom and generic explanations" do
30
- exp = "#{@args[2]}\n"\
31
- "Expected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
32
- " to respond to `#{@args[0]}`."
33
- assert_equal exp, test_run_results(:fail).first.message
27
+ assert_that(test_run_result_count).equals(2)
28
+ assert_that(test_run_result_count(:pass)).equals(1)
29
+ assert_that(test_run_result_count(:fail)).equals(1)
30
+
31
+ exp =
32
+ "#{args1[2]}\n"\
33
+ "Expected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\
34
+ " to respond to `#{args1[0]}`."
35
+ assert_that(test_run_results(:fail).first.message).equals(exp)
34
36
  end
35
37
  end
36
38
 
@@ -38,30 +40,31 @@ module Assert::Assertions
38
40
  include Assert::Test::TestHelpers
39
41
 
40
42
  desc "`assert_not_respond_to`"
41
- setup do
42
- desc = @desc = "assert not respond to fail desc"
43
- args = @args = [:abs, 1, desc]
44
- @test = Factory.test do
43
+ subject { test1 }
44
+
45
+ let(:desc1) { "assert not respond to fail desc" }
46
+ let(:args1) { [:abs, 1, desc1] }
47
+ let(:test1) {
48
+ args = args1
49
+ Factory.test do
45
50
  assert_not_respond_to(*args) # fail
46
51
  assert_not_respond_to(:abs, "1") # pass
47
52
  end
48
- @c = @test.config
49
- @test.run(&test_run_callback)
50
- end
51
- subject{ @test }
53
+ }
54
+ let(:config1) { test1.config }
52
55
 
53
56
  should "produce results as expected" do
54
- assert_equal 2, test_run_result_count
55
- assert_equal 1, test_run_result_count(:pass)
56
- assert_equal 1, test_run_result_count(:fail)
57
- end
57
+ subject.run(&test_run_callback)
58
58
 
59
- should "have a fail message with custom and generic explanations" do
60
- exp = "#{@args[2]}\n"\
61
- "Expected #{Assert::U.show(@args[1], @c)} (#{@args[1].class})"\
62
- " to not respond to `#{@args[0]}`."
63
- assert_equal exp, test_run_results(:fail).first.message
59
+ assert_that(test_run_result_count).equals(2)
60
+ assert_that(test_run_result_count(:pass)).equals(1)
61
+ assert_that(test_run_result_count(:fail)).equals(1)
62
+
63
+ exp =
64
+ "#{args1[2]}\n"\
65
+ "Expected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\
66
+ " to not respond to `#{args1[0]}`."
67
+ assert_that(test_run_results(:fail).first.message).equals(exp)
64
68
  end
65
69
  end
66
70
  end
67
-
@@ -8,32 +8,36 @@ module Assert::Assertions
8
8
  include Assert::Test::TestHelpers
9
9
 
10
10
  desc "`assert_same`"
11
- setup do
12
- klass = Class.new; object = klass.new
13
- desc = @desc = "assert same fail desc"
14
- args = @args = [object, klass.new, desc]
15
- @test = Factory.test do
11
+ subject { test1 }
12
+
13
+ let(:class1) { Class.new }
14
+ let(:object1) { class1.new }
15
+ let(:desc1) { "assert same fail desc" }
16
+ let(:args1) { [object1, class1.new, desc1] }
17
+ let(:test1) {
18
+ args = args1
19
+ object = object1
20
+ Factory.test do
16
21
  assert_same(object, object) # pass
17
22
  assert_same(*args) # fail
18
23
  end
19
- @c = @test.config
20
- @test.run(&test_run_callback)
21
- end
22
- subject{ @test }
24
+ }
25
+ let(:config1) { test1.config }
23
26
 
24
27
  should "produce results as expected" do
25
- assert_equal 2, test_run_result_count
26
- assert_equal 1, test_run_result_count(:pass)
27
- assert_equal 1, test_run_result_count(:fail)
28
- end
29
-
30
- should "have a fail message with custom and generic explanations" do
31
- exp = "#{@args[2]}\n"\
32
- "Expected #{Assert::U.show(@args[1], @c)}"\
33
- " (#<#{@args[1].class}:#{"0x0%x" % (@args[1].object_id << 1)}>)"\
34
- " to be the same as #{Assert::U.show(@args[0], @c)}"\
35
- " (#<#{@args[0].class}:#{"0x0%x" % (@args[0].object_id << 1)}>)."
36
- assert_equal exp, test_run_results(:fail).first.message
28
+ subject.run(&test_run_callback)
29
+
30
+ assert_that(test_run_result_count).equals(2)
31
+ assert_that(test_run_result_count(:pass)).equals(1)
32
+ assert_that(test_run_result_count(:fail)).equals(1)
33
+
34
+ exp =
35
+ "#{args1[2]}\n"\
36
+ "Expected #{Assert::U.show(args1[1], config1)}"\
37
+ " (#<#{args1[1].class}:#{"0x0%x" % (args1[1].object_id << 1)}>)"\
38
+ " to be the same as #{Assert::U.show(args1[0], config1)}"\
39
+ " (#<#{args1[0].class}:#{"0x0%x" % (args1[0].object_id << 1)}>)."
40
+ assert_that(test_run_results(:fail).first.message).equals(exp)
37
41
  end
38
42
  end
39
43
 
@@ -41,32 +45,37 @@ module Assert::Assertions
41
45
  include Assert::Test::TestHelpers
42
46
 
43
47
  desc "`assert_not_same`"
44
- setup do
45
- klass = Class.new; object = klass.new
46
- desc = @desc = "assert not same fail desc"
47
- args = @args = [object, object, desc]
48
- @test = Factory.test do
48
+ subject { test1 }
49
+
50
+ let(:class1) { Class.new }
51
+ let(:object1) { class1.new }
52
+ let(:desc1) { "assert not same fail desc" }
53
+ let(:args1) { [object1, object1, desc1] }
54
+ let(:test1) {
55
+ args = args1
56
+ object = object1
57
+ klass = class1
58
+ Factory.test do
49
59
  assert_not_same(*args) # fail
50
60
  assert_not_same(object, klass.new) # pass
51
61
  end
52
- @c = @test.config
53
- @test.run(&test_run_callback)
54
- end
55
- subject{ @test }
62
+ }
63
+ let(:config1) { test1.config }
56
64
 
57
65
  should "produce results as expected" do
58
- assert_equal 2, test_run_result_count
59
- assert_equal 1, test_run_result_count(:pass)
60
- assert_equal 1, test_run_result_count(:fail)
61
- end
62
-
63
- should "have a fail message with custom and generic explanations" do
64
- exp = "#{@args[2]}\n"\
65
- "Expected #{Assert::U.show(@args[1], @c)}"\
66
- " (#<#{@args[1].class}:#{"0x0%x" % (@args[1].object_id << 1)}>)"\
67
- " to not be the same as #{Assert::U.show(@args[0], @c)}"\
68
- " (#<#{@args[0].class}:#{"0x0%x" % (@args[0].object_id << 1)}>)."
69
- assert_equal exp, test_run_results(:fail).first.message
66
+ subject.run(&test_run_callback)
67
+
68
+ assert_that(test_run_result_count).equals(2)
69
+ assert_that(test_run_result_count(:pass)).equals(1)
70
+ assert_that(test_run_result_count(:fail)).equals(1)
71
+
72
+ exp =
73
+ "#{args1[2]}\n"\
74
+ "Expected #{Assert::U.show(args1[1], config1)}"\
75
+ " (#<#{args1[1].class}:#{"0x0%x" % (args1[1].object_id << 1)}>)"\
76
+ " to not be the same as #{Assert::U.show(args1[0], config1)}"\
77
+ " (#<#{args1[0].class}:#{"0x0%x" % (args1[0].object_id << 1)}>)."
78
+ assert_that(test_run_results(:fail).first.message).equals(exp)
70
79
  end
71
80
  end
72
81
 
@@ -74,62 +83,64 @@ module Assert::Assertions
74
83
  include Assert::Test::TestHelpers
75
84
 
76
85
  desc "with objects that should use diff when showing"
77
- setup do
78
- @exp_obj = "I'm a\nstring"
79
- @act_obj = "I am a \nstring"
80
-
81
- @c = Factory.modes_off_config
82
- @c.use_diff_proc(Assert::U.default_use_diff_proc)
83
- @c.run_diff_proc(Assert::U.syscmd_diff_proc)
86
+ let(:config1) {
87
+ Factory.modes_off_config.tap do |config|
88
+ config.use_diff_proc(Assert::U.default_use_diff_proc)
89
+ config.run_diff_proc(Assert::U.syscmd_diff_proc)
90
+ end
91
+ }
84
92
 
85
- @exp_obj_show = Assert::U.show_for_diff(@exp_obj, @c)
86
- @act_obj_show = Assert::U.show_for_diff(@act_obj, @c)
87
- end
93
+ let(:exp_obj1) { "I'm a\nstring" }
94
+ let(:act_obj1) { "I am a \nstring" }
95
+ let(:exp_obj_show1) { Assert::U.show_for_diff(exp_obj1, config1) }
96
+ let(:act_obj_show1) { Assert::U.show_for_diff(act_obj1, config1) }
88
97
  end
89
98
 
90
99
  class AssertSameDiffTests < DiffTests
91
100
  desc "`assert_same`"
92
- setup do
93
- exp_obj, act_obj = @exp_obj, @act_obj
94
- @test = Factory.test(@c) do
101
+ subject { test1 }
102
+
103
+ let(:test1) {
104
+ exp_obj, act_obj = exp_obj1, act_obj1
105
+ Factory.test(config1) do
95
106
  assert_same(exp_obj, act_obj)
96
107
  end
97
- @test.run(&test_run_callback)
98
- end
99
- subject{ @test }
108
+ }
100
109
 
101
110
  should "include diff output in the fail messages" do
102
- exp = "Expected #<#{@act_obj.class}:#{"0x0%x" % (@act_obj.object_id << 1)}>"\
103
- " to be the same as"\
104
- " #<#{@exp_obj.class}:#{"0x0%x" % (@exp_obj.object_id << 1)}>"\
105
- ", diff:\n"\
106
- "#{Assert::U.syscmd_diff_proc.call(@exp_obj_show, @act_obj_show)}"
107
- assert_equal exp, test_run_results(:fail).first.message
111
+ subject.run(&test_run_callback)
112
+
113
+ exp =
114
+ "Expected #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
115
+ " to be the same as"\
116
+ " #<#{exp_obj1.class}:#{"0x0%x" % (exp_obj1.object_id << 1)}>"\
117
+ ", diff:\n"\
118
+ "#{Assert::U.syscmd_diff_proc.call(exp_obj_show1, act_obj_show1)}"
119
+ assert_that(test_run_results(:fail).first.message).equals(exp)
108
120
  end
109
121
  end
110
122
 
111
123
  class AssertNotSameDiffTests < DiffTests
112
124
  desc "`assert_not_same`"
113
- setup do
114
- @exp_obj = @act_obj
115
- @exp_obj_show = @act_obj_show
125
+ subject { test1 }
116
126
 
117
- exp_obj, act_obj = @exp_obj, @act_obj
118
- @test = Factory.test(@c) do
119
- assert_not_same(exp_obj, exp_obj)
127
+ let(:test1) {
128
+ act_obj = act_obj1
129
+ Factory.test(config1) do
130
+ assert_not_same(act_obj, act_obj)
120
131
  end
121
- @test.run(&test_run_callback)
122
- end
123
- subject{ @test }
132
+ }
124
133
 
125
134
  should "include diff output in the fail messages" do
126
- exp = "Expected #<#{@act_obj.class}:#{"0x0%x" % (@act_obj.object_id << 1)}>"\
127
- " to not be the same as"\
128
- " #<#{@exp_obj.class}:#{"0x0%x" % (@exp_obj.object_id << 1)}>"\
129
- ", diff:\n"\
130
- "#{Assert::U.syscmd_diff_proc.call(@exp_obj_show, @act_obj_show)}"
131
- assert_equal exp, test_run_results(:fail).first.message
135
+ subject.run(&test_run_callback)
136
+
137
+ exp =
138
+ "Expected #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
139
+ " to not be the same as"\
140
+ " #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
141
+ ", diff:\n"\
142
+ "#{Assert::U.syscmd_diff_proc.call(act_obj_show1, act_obj_show1)}"
143
+ assert_that(test_run_results(:fail).first.message).equals(exp)
132
144
  end
133
145
  end
134
146
  end
135
-