Sha256: 6750bc2a7ce20d63ab11efb38ae4d9315b1e4e43f9e02b2285be4973215c17fb
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require 'assert' require 'qs/job_handler' require 'qs/message_handler' module Qs::JobHandler class UnitTests < Assert::Context desc "Qs::JobHandler" setup do @handler_class = Class.new{ include Qs::JobHandler } end subject{ @handler_class } should "be a message handler" do assert_includes Qs::MessageHandler, subject end end class InitTests < UnitTests desc "when init" setup do @runner = FakeRunner.new @handler = TestJobHandler.new(@runner) end subject{ @handler } should "know its job, job name and job created at" do assert_equal @runner.message, subject.public_job assert_equal subject.public_job.name, subject.public_job_name assert_equal subject.public_job.created_at, subject.public_job_created_at end should "have a custom inspect" do reference = '0x0%x' % (subject.object_id << 1) exp = "#<#{subject.class}:#{reference} " \ "@job=#{@handler.public_job.inspect}>" assert_equal exp, subject.inspect end end class TestJobHandler include Qs::JobHandler def public_job; job; end def public_job_name; job_name; end def public_job_created_at; job_created_at; end end class FakeRunner attr_accessor :message def initialize @message = Factory.job end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qs-0.5.0 | test/unit/job_handler_tests.rb |
qs-0.4.0 | test/unit/job_handler_tests.rb |