test/unit/config_helpers_tests.rb in assert-2.19.2 vs test/unit/config_helpers_tests.rb in assert-2.19.3
- old
+ new
@@ -6,28 +6,28 @@
require "assert/config"
module Assert::ConfigHelpers
class UnitTests < Assert::Context
desc "Assert::ConfigHelpers"
- subject { unit_class }
+ subject{ unit_class }
- let(:unit_class) {
+ let(:unit_class) do
Class.new do
include Assert::ConfigHelpers
def config
# use the assert config since it has tests, contexts, etc
# also use a fresh config that is empty
@config ||= [Assert.config, Assert::Config.new].sample
end
end
- }
+ end
end
class InitTests < UnitTests
desc "when init"
- subject { unit_class.new }
+ subject{ unit_class.new }
should have_imeths :runner, :suite, :view
should have_imeths :runner_seed, :single_test?, :single_test_file_line
should have_imeths :tests_to_run?, :tests_to_run_count
should have_imeths :test_count, :result_count, :pass_result_count
@@ -49,14 +49,14 @@
should "know its runner seed" do
assert_that(subject.runner_seed).equals(subject.config.runner_seed)
end
should "know if it is in single test mode" do
- Assert.stub(subject.config, :single_test?) { true }
+ Assert.stub(subject.config, :single_test?){ true }
assert_that(subject.single_test?).is_true
- Assert.stub(subject.config, :single_test?) { false }
+ Assert.stub(subject.config, :single_test?){ false }
assert_that(subject.single_test?).is_false
end
should "know its single test file line" do
exp = subject.config.single_test_file_line
@@ -117,11 +117,12 @@
assert_that(subject.formatted_result_rate(test_rate, format)).equals(exp)
assert_that(subject.formatted_result_rate(test_rate)).equals(exp)
result_rate = Factory.float
exp = format % result_rate
- assert_that(subject.formatted_result_rate(result_rate, format)).equals(exp)
+ assert_that(subject.formatted_result_rate(result_rate, format))
+ .equals(exp)
assert_that(subject.formatted_result_rate(result_rate)).equals(exp)
end
should "know its formatted suite run time, test rate and result rate" do
format = "%.6f"
@@ -135,20 +136,24 @@
exp = format % subject.config.suite.result_rate
assert_that(subject.formatted_suite_result_rate(format)).equals(exp)
end
should "know whether to show test profile info" do
- assert_that(subject.show_test_profile_info?).equals(!!subject.config.profile)
+ assert_that(subject.show_test_profile_info?)
+ .equals(!!subject.config.profile)
end
should "know whether to show verbose info" do
- assert_that(subject.show_test_verbose_info?).equals(!!subject.config.verbose)
+ assert_that(subject.show_test_verbose_info?)
+ .equals(!!subject.config.verbose)
end
should "know what result types occur in a suite's results" do
result_types = [:pass, :fail, :ignore, :skip, :error]
result_count = Factory.integer
- Assert.stub(subject, "#{result_types.sample}_result_count"){ result_count }
+ Assert.stub(subject, "#{result_types.sample}_result_count") do
+ result_count
+ end
exp = result_types.select do |type_sym|
subject.send("#{type_sym}_result_count") > 0
end
assert_that(subject.ocurring_result_types).equals(exp)