assert 2.16.5 → 2.18.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -7
  2. data/Gemfile +3 -1
  3. data/README.md +79 -54
  4. data/assert.gemspec +6 -5
  5. data/bin/assert +4 -4
  6. data/lib/assert.rb +8 -18
  7. data/lib/assert/actual_value.rb +127 -0
  8. data/lib/assert/assert_runner.rb +7 -10
  9. data/lib/assert/assertions.rb +15 -28
  10. data/lib/assert/cli.rb +41 -57
  11. data/lib/assert/config.rb +8 -12
  12. data/lib/assert/config_helpers.rb +6 -10
  13. data/lib/assert/context.rb +30 -24
  14. data/lib/assert/context/let_dsl.rb +13 -0
  15. data/lib/assert/context/method_missing.rb +19 -0
  16. data/lib/assert/context/setup_dsl.rb +0 -4
  17. data/lib/assert/context/subject_dsl.rb +0 -4
  18. data/lib/assert/context/suite_dsl.rb +0 -4
  19. data/lib/assert/context/test_dsl.rb +5 -9
  20. data/lib/assert/context_info.rb +2 -6
  21. data/lib/assert/default_runner.rb +1 -5
  22. data/lib/assert/default_suite.rb +1 -6
  23. data/lib/assert/default_view.rb +8 -12
  24. data/lib/assert/factory.rb +1 -4
  25. data/lib/assert/file_line.rb +0 -4
  26. data/lib/assert/macro.rb +1 -4
  27. data/lib/assert/macros/methods.rb +5 -11
  28. data/lib/assert/result.rb +19 -34
  29. data/lib/assert/runner.rb +12 -11
  30. data/lib/assert/stub.rb +16 -2
  31. data/lib/assert/suite.rb +3 -7
  32. data/lib/assert/test.rb +13 -18
  33. data/lib/assert/utils.rb +8 -12
  34. data/lib/assert/version.rb +1 -1
  35. data/lib/assert/view.rb +18 -21
  36. data/lib/assert/view_helpers.rb +6 -17
  37. data/log/{.gitkeep → .keep} +0 -0
  38. data/test/helper.rb +26 -41
  39. data/test/support/factory.rb +20 -6
  40. data/test/support/inherited_stuff.rb +0 -2
  41. data/test/system/stub_tests.rb +350 -354
  42. data/test/system/test_tests.rb +119 -133
  43. data/test/unit/actual_value_tests.rb +335 -0
  44. data/test/unit/assert_tests.rb +125 -52
  45. data/test/unit/assertions/assert_block_tests.rb +34 -37
  46. data/test/unit/assertions/assert_empty_tests.rb +38 -38
  47. data/test/unit/assertions/assert_equal_tests.rb +84 -86
  48. data/test/unit/assertions/assert_file_exists_tests.rb +37 -39
  49. data/test/unit/assertions/assert_includes_tests.rb +45 -46
  50. data/test/unit/assertions/assert_instance_of_tests.rb +39 -40
  51. data/test/unit/assertions/assert_kind_of_tests.rb +39 -40
  52. data/test/unit/assertions/assert_match_tests.rb +39 -40
  53. data/test/unit/assertions/assert_nil_tests.rb +35 -38
  54. data/test/unit/assertions/assert_raises_tests.rb +58 -62
  55. data/test/unit/assertions/assert_respond_to_tests.rb +41 -42
  56. data/test/unit/assertions/assert_same_tests.rb +94 -90
  57. data/test/unit/assertions/assert_true_false_tests.rb +67 -69
  58. data/test/unit/assertions_tests.rb +17 -19
  59. data/test/unit/config_helpers_tests.rb +41 -43
  60. data/test/unit/config_tests.rb +42 -46
  61. data/test/unit/context/let_dsl_tests.rb +10 -0
  62. data/test/unit/context/setup_dsl_tests.rb +72 -91
  63. data/test/unit/context/subject_dsl_tests.rb +18 -51
  64. data/test/unit/context/suite_dsl_tests.rb +19 -23
  65. data/test/unit/context/test_dsl_tests.rb +52 -59
  66. data/test/unit/context_info_tests.rb +19 -21
  67. data/test/unit/context_tests.rb +175 -178
  68. data/test/unit/default_runner_tests.rb +4 -10
  69. data/test/unit/default_suite_tests.rb +54 -59
  70. data/test/unit/factory_tests.rb +6 -9
  71. data/test/unit/file_line_tests.rb +34 -40
  72. data/test/unit/macro_tests.rb +11 -20
  73. data/test/unit/result_tests.rb +156 -182
  74. data/test/unit/runner_tests.rb +72 -79
  75. data/test/unit/suite_tests.rb +62 -63
  76. data/test/unit/test_tests.rb +143 -147
  77. data/test/unit/utils_tests.rb +49 -62
  78. data/test/unit/view_helpers_tests.rb +67 -70
  79. data/test/unit/view_tests.rb +26 -32
  80. metadata +54 -47
  81. data/.assert.rb +0 -3
  82. data/.gitignore +0 -19
@@ -1,148 +1,135 @@
1
- require 'assert'
2
- require 'assert/utils'
1
+ require "assert"
2
+ require "assert/utils"
3
3
 
4
- require 'tempfile'
5
- require 'assert/config'
4
+ require "tempfile"
5
+ require "assert/config"
6
6
 
7
7
  module Assert::Utils
8
-
9
8
  class UnitTests < Assert::Context
10
9
  desc "Assert::Utils"
11
- subject{ Assert::Utils }
12
- setup do
13
- @objs = [ 1, 'hi there', Hash.new, [:a, :b]]
14
- end
10
+ subject { Assert::Utils }
11
+
12
+ let(:objs1) { [1, "hi there", Hash.new, [:a, :b]] }
15
13
 
16
14
  should have_imeths :show, :show_for_diff
17
15
  should have_imeths :tempfile
18
16
  should have_imeths :stdlib_pp_proc, :default_use_diff_proc, :syscmd_diff_proc
19
17
  should have_imeths :git_changed_proc
20
-
21
18
  end
22
19
 
23
20
  class ShowTests < UnitTests
24
21
  desc "`show`"
25
- setup do
26
- @pp_config = Assert::Config.new({
22
+
23
+ let(:pp_config1) {
24
+ Assert::Config.new({
27
25
  :pp_objects => true,
28
- :pp_proc => Proc.new{ |input| 'herp derp' }
26
+ :pp_proc => Proc.new{ |input| "herp derp" }
29
27
  })
30
- end
28
+ }
31
29
 
32
30
  should "use `inspect` to show objs when `pp_objects` setting is false" do
33
- @objs.each do |obj|
34
- assert_equal obj.inspect, subject.show(obj, Factory.modes_off_config)
31
+ objs1.each do |obj|
32
+ assert_that(subject.show(obj, Factory.modes_off_config)).equals(obj.inspect)
35
33
  end
36
34
  end
37
35
 
38
36
  should "use `pp_proc` to show objs when `pp_objects` setting is true" do
39
- @objs.each do |obj|
40
- assert_equal @pp_config.pp_proc.call(obj), subject.show(obj, @pp_config)
37
+ objs1.each do |obj|
38
+ assert_that(subject.show(obj, pp_config1)).equals(pp_config1.pp_proc.call(obj))
41
39
  end
42
40
  end
43
-
44
41
  end
45
42
 
46
43
  class ShowForDiffTests < ShowTests
47
44
  desc "`show_for_diff`"
48
- setup do
49
- @w_newlines = { :string => "herp derp, derp herp\nherpderpedia" }
50
- @w_obj_id = Class.new.new
51
- end
45
+
46
+ let(:w_newlines1) { { :string => "herp derp, derp herp\nherpderpedia" } }
47
+ let(:w_obj_id1) { Class.new.new }
52
48
 
53
49
  should "call show, escaping newlines" do
54
50
  exp_out = "{:string=>\"herp derp, derp herp\nherpderpedia\"}"
55
- assert_equal exp_out, subject.show_for_diff(@w_newlines, Factory.modes_off_config)
51
+ assert_that(subject.show_for_diff(w_newlines1, Factory.modes_off_config)).equals(exp_out)
56
52
  end
57
53
 
58
54
  should "make any obj ids generic" do
59
55
  exp_out = "#<#<Class:0xXXXXXX>:0xXXXXXX>"
60
- assert_equal exp_out, subject.show_for_diff(@w_obj_id, Factory.modes_off_config)
56
+ assert_that(subject.show_for_diff(w_obj_id1, Factory.modes_off_config)).equals(exp_out)
61
57
  end
62
-
63
58
  end
64
59
 
65
60
  class TempfileTests < UnitTests
66
61
  desc "`tempfile`"
67
62
 
68
63
  should "require tempfile, open a tempfile, write the given content, and yield it" do
69
- subject.tempfile('a-name', 'some-content') do |tmpfile|
70
- assert_equal false, (require 'tempfile')
64
+ subject.tempfile("a-name", "some-content") do |tmpfile|
65
+ assert_that((require "tempfile")).equals(false)
71
66
  assert tmpfile
72
- assert_kind_of Tempfile, tmpfile
67
+ assert_that(tmpfile).is_kind_of(Tempfile)
73
68
 
74
69
  tmpfile.pos = 0
75
- assert_equal "some-content\n", tmpfile.read
70
+ assert_that(tmpfile.read).equals("some-content\n")
76
71
  end
77
72
  end
78
-
79
73
  end
80
74
 
81
75
  class StdlibPpProcTests < UnitTests
82
76
  desc "`stdlib_pp_proc`"
83
77
 
84
78
  should "build a pp proc that uses stdlib `PP.pp` to pretty print objects" do
85
- exp_obj_pps = @objs.map{ |o| PP.pp(o, '', 79).strip }
86
- act_obj_pps = @objs.map{ |o| subject.stdlib_pp_proc.call(o) }
87
- assert_equal exp_obj_pps, act_obj_pps
79
+ exp_obj_pps = objs1.map{ |o| PP.pp(o, "", 79).strip }
80
+ act_obj_pps = objs1.map{ |o| subject.stdlib_pp_proc.call(o) }
81
+ assert_that(act_obj_pps).equals(exp_obj_pps)
88
82
 
89
83
  cust_width = 1
90
- exp_obj_pps = @objs.map{ |o| PP.pp(o, '', cust_width).strip }
91
- act_obj_pps = @objs.map{ |o| subject.stdlib_pp_proc(cust_width).call(o) }
92
- assert_equal exp_obj_pps, act_obj_pps
84
+ exp_obj_pps = objs1.map{ |o| PP.pp(o, "", cust_width).strip }
85
+ act_obj_pps = objs1.map{ |o| subject.stdlib_pp_proc(cust_width).call(o) }
86
+ assert_that(act_obj_pps).equals(exp_obj_pps)
93
87
  end
94
-
95
88
  end
96
89
 
97
90
  class DefaultUseDiffProcTests < UnitTests
98
91
  desc "`default_use_diff_proc`"
99
- setup do
100
- @longer = "i am a really long string output; use diff when working with me"
101
- @newlines = "i have\n newlines"
102
- end
92
+
93
+ let(:longer1) { "i am a really long string output; use diff when working with me" }
94
+ let(:newlines1) { "i have\n newlines" }
103
95
 
104
96
  should "be true if either output has newlines or is bigger than 29 chars" do
105
97
  proc = subject.default_use_diff_proc
106
98
 
107
- assert_not proc.call('', '')
108
- assert proc.call(@longer, '')
109
- assert proc.call(@newlines, '')
110
- assert proc.call('', @longer)
111
- assert proc.call('', @newlines)
112
- assert proc.call(@longer, @newlines)
99
+ assert_not proc.call("", "")
100
+ assert proc.call(longer1, "")
101
+ assert proc.call(newlines1, "")
102
+ assert proc.call("", longer1)
103
+ assert proc.call("", newlines1)
104
+ assert proc.call(longer1, newlines1)
113
105
  end
114
-
115
106
  end
116
107
 
117
108
  class SyscmdDiffProc < UnitTests
118
109
  desc "`syscmd_diff_proc`"
119
- setup do
120
- @diff_a_file = File.join(ROOT_PATH, 'test/support/diff_a.txt')
121
- @diff_b_file = File.join(ROOT_PATH, 'test/support/diff_b.txt')
122
110
 
123
- @diff_a = File.read(@diff_a_file)
124
- @diff_b = File.read(@diff_b_file)
125
- end
111
+ let(:diff_a_file1) { File.join(ROOT_PATH, "test/support/diff_a.txt") }
112
+ let(:diff_b_file1) { File.join(ROOT_PATH, "test/support/diff_b.txt") }
113
+ let(:diff_a1) { File.read(diff_a_file1) }
114
+ let(:diff_b1) { File.read(diff_b_file1) }
126
115
 
127
116
  should "use the diff syscmd to output the diff between the exp/act show output" do
128
- exp_diff_out = `diff --unified=-1 #{@diff_a_file} #{@diff_b_file}`.strip.tap do |out|
117
+ exp_diff_out = `diff --unified=-1 #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
129
118
  out.sub!(/^\-\-\- .+/, "--- expected")
130
119
  out.sub!(/^\+\+\+ .+/, "+++ actual")
131
120
  end
132
121
 
133
- assert_equal exp_diff_out, subject.syscmd_diff_proc.call(@diff_a, @diff_b)
122
+ assert_that(subject.syscmd_diff_proc.call(diff_a1, diff_b1)).equals(exp_diff_out)
134
123
  end
135
124
 
136
125
  should "allow you to specify a custom syscmd" do
137
- cust_syscmd = 'diff'
138
- exp_diff_out = `#{cust_syscmd} #{@diff_a_file} #{@diff_b_file}`.strip.tap do |out|
126
+ cust_syscmd = "diff"
127
+ exp_diff_out = `#{cust_syscmd} #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
139
128
  out.sub!(/^\-\-\- .+/, "--- expected")
140
129
  out.sub!(/^\+\+\+ .+/, "+++ actual")
141
130
  end
142
131
 
143
- assert_equal exp_diff_out, subject.syscmd_diff_proc(cust_syscmd).call(@diff_a, @diff_b)
132
+ assert_that(subject.syscmd_diff_proc(cust_syscmd).call(diff_a1, diff_b1)).equals(exp_diff_out)
144
133
  end
145
-
146
134
  end
147
-
148
135
  end
@@ -1,22 +1,24 @@
1
- require 'assert'
2
- require 'assert/view_helpers'
1
+ require "assert"
2
+ require "assert/view_helpers"
3
3
 
4
- require 'stringio'
5
- require 'assert/config'
6
- require 'assert/config_helpers'
7
- require 'assert/result'
8
- require 'assert/view'
4
+ require "stringio"
5
+ require "assert/config"
6
+ require "assert/config_helpers"
7
+ require "assert/result"
8
+ require "assert/view"
9
9
 
10
10
  module Assert::ViewHelpers
11
-
12
11
  class UnitTests < Assert::Context
13
12
  desc "Assert::ViewHelpers"
14
- setup do
15
- test_opt_val = @test_opt_val = Factory.string
16
- @helpers_class = Class.new do
13
+ subject { helpers_class1 }
14
+
15
+ let(:test_opt_val1) { Factory.string }
16
+ let(:helpers_class1) {
17
+ test_opt_val = test_opt_val1
18
+ Class.new do
17
19
  include Assert::ViewHelpers
18
20
 
19
- option 'test_opt', test_opt_val
21
+ option "test_opt", test_opt_val
20
22
 
21
23
  def config
22
24
  # use the assert config since it has tests, contexts, etc
@@ -24,36 +26,33 @@ module Assert::ViewHelpers
24
26
  @config ||= [Assert.config, Assert::Config.new].sample
25
27
  end
26
28
  end
27
- end
28
- subject{ @helpers_class }
29
+ }
29
30
 
30
31
  should have_imeths :option
31
32
 
32
33
  should "include the config helpers" do
33
- assert_includes Assert::ConfigHelpers, subject
34
+ assert_that(subject).includes(Assert::ConfigHelpers)
34
35
  end
35
36
 
36
37
  should "write option values" do
37
- helpers = @helpers_class.new
38
- assert_equal @test_opt_val, helpers.test_opt
38
+ helpers = helpers_class1.new
39
+ assert_that(helpers.test_opt).equals(test_opt_val1)
39
40
 
40
41
  new_val = Factory.integer
41
42
  helpers.test_opt new_val
42
- assert_equal new_val, helpers.test_opt
43
+ assert_that(helpers.test_opt).equals(new_val)
43
44
 
44
45
  other_val = Factory.integer
45
46
  helpers.test_opt new_val, other_val
46
- assert_equal [new_val, other_val], helpers.test_opt
47
+ assert_that(helpers.test_opt).equals([new_val, other_val])
47
48
  end
48
-
49
49
  end
50
50
 
51
51
  class InitTests < UnitTests
52
52
  desc "when init"
53
- setup do
54
- @helpers = @helpers_class.new
55
- end
56
- subject{ @helpers }
53
+ subject { helpers1 }
54
+
55
+ let(:helpers1) { helpers_class1.new }
57
56
 
58
57
  should have_imeths :captured_output, :re_run_test_cmd
59
58
  should have_imeths :tests_to_run_count_statement, :result_count_statement
@@ -63,109 +62,109 @@ module Assert::ViewHelpers
63
62
 
64
63
  should "know how to build captured output" do
65
64
  output = Factory.string
66
- exp = "--- stdout ---\n"\
67
- "#{output}"\
68
- "--------------"
69
- assert_equal exp, subject.captured_output(output)
65
+ exp =
66
+ "--- stdout ---\n"\
67
+ "#{output}"\
68
+ "--------------"
69
+ assert_that(subject.captured_output(output)).equals(exp)
70
70
  end
71
71
 
72
72
  should "know how to build the re-run test cmd" do
73
73
  test_id = "#{Dir.pwd}/#{Factory.string}_tests.rb:#{Factory.integer}"
74
- exp = "assert -t #{test_id.gsub(Dir.pwd, '.')}"
75
- assert_equal exp, subject.re_run_test_cmd(test_id)
74
+ exp = "assert -t #{test_id.gsub(Dir.pwd, ".")}"
75
+ assert_that(subject.re_run_test_cmd(test_id)).equals(exp)
76
76
  end
77
77
 
78
78
  should "know its tests-to-run count and result count statements" do
79
- exp = "#{subject.tests_to_run_count} test#{'s' if subject.tests_to_run_count != 1}"
80
- assert_equal exp, subject.tests_to_run_count_statement
79
+ exp = "#{subject.tests_to_run_count} test#{"s" if subject.tests_to_run_count != 1}"
80
+ assert_that(subject.tests_to_run_count_statement).equals(exp)
81
81
 
82
- exp = "#{subject.result_count} result#{'s' if subject.result_count != 1}"
83
- assert_equal exp, subject.result_count_statement
82
+ exp = "#{subject.result_count} result#{"s" if subject.result_count != 1}"
83
+ assert_that(subject.result_count_statement).equals(exp)
84
84
  end
85
85
 
86
86
  should "know how to build a sentence from a list of items" do
87
87
  items = 1.times.map{ Factory.string }
88
- assert_equal items.first, subject.to_sentence(items)
88
+ assert_that(subject.to_sentence(items)).equals(items.first)
89
89
 
90
90
  items = 2.times.map{ Factory.string }
91
- assert_equal items.join(' and '), subject.to_sentence(items)
91
+ assert_that(subject.to_sentence(items)).equals(items.join(" and "))
92
92
 
93
93
  items = (Factory.integer(3)+2).times.map{ Factory.string }
94
94
  exp = [items[0..-2].join(", "), items.last].join(", and ")
95
- assert_equal exp, subject.to_sentence(items)
95
+ assert_that(subject.to_sentence(items)).equals(exp)
96
96
  end
97
97
 
98
98
  should "know its all pass result summary message" do
99
99
  Assert.stub(subject, :result_count){ 0 }
100
- assert_equal "uhh...", subject.all_pass_result_summary_msg
100
+ assert_that(subject.all_pass_result_summary_msg).equals("uhh...")
101
101
 
102
102
  Assert.stub(subject, :result_count){ 1 }
103
- assert_equal "pass", subject.all_pass_result_summary_msg
103
+ assert_that(subject.all_pass_result_summary_msg).equals("pass")
104
104
 
105
105
  Assert.stub(subject, :result_count){ Factory.integer(10)+1 }
106
- assert_equal "all pass", subject.all_pass_result_summary_msg
106
+ assert_that(subject.all_pass_result_summary_msg).equals("all pass")
107
107
  end
108
108
 
109
109
  should "know its result summary msg" do
110
110
  res_type = :pass
111
111
  Assert.stub(subject, :all_pass?){ true }
112
112
  exp = subject.all_pass_result_summary_msg
113
- assert_equal exp, subject.result_summary_msg(res_type)
113
+ assert_that(subject.result_summary_msg(res_type)).equals(exp)
114
114
 
115
115
  Assert.stub(subject, :all_pass?){ false }
116
116
  res_type = [:pass, :ignore, :fail, :skip, :error].sample
117
117
  exp = "#{subject.send("#{res_type}_result_count")} #{res_type.to_s}"
118
- assert_equal exp, subject.result_summary_msg(res_type)
118
+ assert_that(subject.result_summary_msg(res_type)).equals(exp)
119
119
  end
120
120
 
121
121
  should "know its results summary sentence" do
122
- items = subject.ocurring_result_types.map do |result_sym|
123
- subject.result_summary_msg(result_sym)
124
- end
122
+ items =
123
+ subject.ocurring_result_types.map do |result_sym|
124
+ subject.result_summary_msg(result_sym)
125
+ end
125
126
  exp = subject.to_sentence(items)
126
- assert_equal exp, subject.results_summary_sentence
127
+ assert_that(subject.results_summary_sentence).equals(exp)
127
128
 
128
129
  block = proc{ |summary, result| "#{summary}--#{result}" }
129
- items = subject.ocurring_result_types.map do |result_sym|
130
- block.call(subject.result_summary_msg(result_sym), result_sym)
131
- end
130
+ items =
131
+ subject.ocurring_result_types.map do |result_sym|
132
+ block.call(subject.result_summary_msg(result_sym), result_sym)
133
+ end
132
134
  exp = subject.to_sentence(items)
133
- assert_equal exp, subject.results_summary_sentence(&block)
135
+ assert_that(subject.results_summary_sentence(&block)).equals(exp)
134
136
  end
135
-
136
137
  end
137
138
 
138
139
  class AnsiTests < UnitTests
139
140
  desc "Ansi"
140
- subject{ Ansi }
141
+ subject { Ansi }
141
142
 
142
143
  should have_imeths :code_for
143
144
 
144
145
  should "know its codes" do
145
- assert_not_empty subject::CODES
146
+ assert_that(subject::CODES).is_not_empty
146
147
  end
147
148
 
148
149
  should "map its code style names to ansi code strings" do
149
150
  styles = Factory.integer(3).times.map{ subject::CODES.keys.sample }
150
- exp = styles.map{ |n| "\e[#{subject::CODES[n]}m" }.join('')
151
- assert_equal exp, subject.code_for(*styles)
151
+ exp = styles.map{ |n| "\e[#{subject::CODES[n]}m" }.join("")
152
+ assert_that(subject.code_for(*styles)).equals(exp)
152
153
 
153
154
  styles = Factory.integer(3).times.map{ Factory.string }
154
- assert_equal '', subject.code_for(*styles)
155
+ assert_that(subject.code_for(*styles)).equals("")
155
156
 
156
157
  styles = []
157
- assert_equal '', subject.code_for(*styles)
158
+ assert_that(subject.code_for(*styles)).equals("")
158
159
  end
159
-
160
160
  end
161
161
 
162
162
  class AnsiInitTests < UnitTests
163
163
  desc "when mixed in on a view"
164
- setup do
165
- view_class = Class.new(Assert::View){ include Ansi }
166
- @view = view_class.new(Factory.modes_off_config, StringIO.new("", "w+"))
167
- end
168
- subject{ @view }
164
+ subject { view1 }
165
+
166
+ let(:view_class1) { Class.new(Assert::View){ include Ansi } }
167
+ let(:view1) { view_class1.new(Factory.modes_off_config, StringIO.new("", "w+")) }
169
168
 
170
169
  should have_imeths :ansi_styled_msg
171
170
 
@@ -175,28 +174,26 @@ module Assert::ViewHelpers
175
174
 
176
175
  Assert.stub(subject, :is_tty?){ false }
177
176
  Assert.stub(subject, :styled){ false }
178
- assert_equal msg, subject.ansi_styled_msg(msg, result_type)
177
+ assert_that(subject.ansi_styled_msg(msg, result_type)).equals(msg)
179
178
 
180
179
  Assert.stub(subject, :is_tty?){ false }
181
180
  Assert.stub(subject, :styled){ true }
182
- assert_equal msg, subject.ansi_styled_msg(msg, result_type)
181
+ assert_that(subject.ansi_styled_msg(msg, result_type)).equals(msg)
183
182
 
184
183
  Assert.stub(subject, :is_tty?){ true }
185
184
  Assert.stub(subject, :styled){ false }
186
- assert_equal msg, subject.ansi_styled_msg(msg, result_type)
185
+ assert_that(subject.ansi_styled_msg(msg, result_type)).equals(msg)
187
186
 
188
187
  Assert.stub(subject, :is_tty?){ true }
189
188
  Assert.stub(subject, :styled){ true }
190
189
  Assert.stub(subject, "#{result_type}_styles"){ [] }
191
- assert_equal msg, subject.ansi_styled_msg(msg, result_type)
190
+ assert_that(subject.ansi_styled_msg(msg, result_type)).equals(msg)
192
191
 
193
192
  styles = Factory.integer(3).times.map{ Assert::ViewHelpers::Ansi::CODES.keys.sample }
194
193
  Assert.stub(subject, "#{result_type}_styles"){ styles }
195
194
  exp_code = Assert::ViewHelpers::Ansi.code_for(*styles)
196
195
  exp = exp_code + msg + Assert::ViewHelpers::Ansi.code_for(:reset)
197
- assert_equal exp, subject.ansi_styled_msg(msg, result_type)
196
+ assert_that(subject.ansi_styled_msg(msg, result_type)).equals(exp)
198
197
  end
199
-
200
198
  end
201
-
202
199
  end