test/unit/view_helpers_tests.rb in assert-2.16.5 vs test/unit/view_helpers_tests.rb in assert-2.17.0
- old
+ new
@@ -1,24 +1,24 @@
-require 'assert'
-require 'assert/view_helpers'
+require "assert"
+require "assert/view_helpers"
-require 'stringio'
-require 'assert/config'
-require 'assert/config_helpers'
-require 'assert/result'
-require 'assert/view'
+require "stringio"
+require "assert/config"
+require "assert/config_helpers"
+require "assert/result"
+require "assert/view"
module Assert::ViewHelpers
class UnitTests < Assert::Context
desc "Assert::ViewHelpers"
setup do
test_opt_val = @test_opt_val = Factory.string
@helpers_class = Class.new do
include Assert::ViewHelpers
- option 'test_opt', test_opt_val
+ option "test_opt", test_opt_val
def config
# use the assert config since it has tests, contexts, etc
# also maybe use a fresh config that is empty
@config ||= [Assert.config, Assert::Config.new].sample
@@ -69,28 +69,28 @@
assert_equal exp, subject.captured_output(output)
end
should "know how to build the re-run test cmd" do
test_id = "#{Dir.pwd}/#{Factory.string}_tests.rb:#{Factory.integer}"
- exp = "assert -t #{test_id.gsub(Dir.pwd, '.')}"
+ exp = "assert -t #{test_id.gsub(Dir.pwd, ".")}"
assert_equal exp, subject.re_run_test_cmd(test_id)
end
should "know its tests-to-run count and result count statements" do
- exp = "#{subject.tests_to_run_count} test#{'s' if subject.tests_to_run_count != 1}"
+ exp = "#{subject.tests_to_run_count} test#{"s" if subject.tests_to_run_count != 1}"
assert_equal exp, subject.tests_to_run_count_statement
- exp = "#{subject.result_count} result#{'s' if subject.result_count != 1}"
+ exp = "#{subject.result_count} result#{"s" if subject.result_count != 1}"
assert_equal exp, subject.result_count_statement
end
should "know how to build a sentence from a list of items" do
items = 1.times.map{ Factory.string }
assert_equal items.first, subject.to_sentence(items)
items = 2.times.map{ Factory.string }
- assert_equal items.join(' and '), subject.to_sentence(items)
+ assert_equal items.join(" and "), subject.to_sentence(items)
items = (Factory.integer(3)+2).times.map{ Factory.string }
exp = [items[0..-2].join(", "), items.last].join(", and ")
assert_equal exp, subject.to_sentence(items)
end
@@ -145,17 +145,17 @@
assert_not_empty subject::CODES
end
should "map its code style names to ansi code strings" do
styles = Factory.integer(3).times.map{ subject::CODES.keys.sample }
- exp = styles.map{ |n| "\e[#{subject::CODES[n]}m" }.join('')
+ exp = styles.map{ |n| "\e[#{subject::CODES[n]}m" }.join("")
assert_equal exp, subject.code_for(*styles)
styles = Factory.integer(3).times.map{ Factory.string }
- assert_equal '', subject.code_for(*styles)
+ assert_equal "", subject.code_for(*styles)
styles = []
- assert_equal '', subject.code_for(*styles)
+ assert_equal "", subject.code_for(*styles)
end
end
class AnsiInitTests < UnitTests