Sha256: 3c25b857ac7d60dce9eea3bd9182c7588a9a0d21338521d0eb83bee5f5db6da7
Contents?: true
Size: 822 Bytes
Versions: 13
Compression:
Stored size: 822 Bytes
Contents
require_relative 'test_helper' describe Adrian::Worker do describe "#perform" do before { @item = 2} it "should report back to the boss" do worker_class = Class.new(Adrian::Worker) do def work; item + 2; end end worker = worker_class.new(@item) boss = MiniTest::Mock.new worker.report_to(boss) boss.expect(:work_done, nil, [@item, worker, nil]) worker.perform boss.verify end it "should NEVER raise an exception" do worker_class = Class.new(Adrian::Worker) do def work; raise "STRIKE!"; end end worker = worker_class.new(@item) boss = MiniTest::Mock.new worker.report_to(boss) boss.expect(:work_done, nil, [@item, worker, RuntimeError]) worker.perform boss.verify end end end
Version data entries
13 entries across 13 versions & 1 rubygems