Sha256: 452c4c206b871029358e2a61021188b634e61ab129f17d85f39a3f63d0aa63de
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require 'assert' require 'qs/runner' require 'qs/job_handler' require 'qs/logger' class Qs::Runner class UnitTests < Assert::Context desc "Qs::Runner" setup do @runner_class = Qs::Runner end subject{ @runner_class } end class InitTests < UnitTests desc "when init" setup do @handler_class = TestJobHandler @runner = @runner_class.new(@handler_class) end subject{ @runner } should have_readers :handler_class, :handler should have_readers :job, :params, :logger should have_imeths :run should "know its handler class and handler" do assert_equal @handler_class, subject.handler_class assert_instance_of @handler_class, subject.handler end should "not set its job, params or logger by default" do assert_nil subject.job assert_equal({}, subject.params) assert_instance_of Qs::NullLogger, subject.logger end should "allow passing a job, params and logger" do args = { :job => Factory.string, :params => Factory.string, :logger => Factory.string } runner = @runner_class.new(@handler_class, args) assert_equal args[:job], runner.job assert_equal args[:params], runner.params assert_equal args[:logger], runner.logger end should "raise a not implemented error when run" do assert_raises(NotImplementedError){ subject.run } end end class TestJobHandler include Qs::JobHandler end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qs-0.3.0 | test/unit/runner_tests.rb |
qs-0.2.0 | test/unit/runner_tests.rb |
qs-0.1.0 | test/unit/runner_tests.rb |