Sha256: c121e6817ae15a7f966b33f6f993d2c9907dec145e0ac8733ee038f173cd2741
Contents?: true
Size: 1022 Bytes
Versions: 3
Compression:
Stored size: 1022 Bytes
Contents
# frozen_string_literal: true require "spec_helpers" describe Wayfarer::Middleware::Dispatch do let(:task) { build(:task) } let(:action) { :action } subject(:chain) { described_class.new } before do task.metadata.controller = spy task.metadata.action = action allow(task.metadata.controller).to receive(:run_callbacks).and_yield end describe "#call" do it "runs callbacks" do expect(task.metadata.controller).to receive(:run_callbacks).with(action) subject.call(task) end context "when action is a Symbol" do it "calls the method" do expect(task.metadata.controller).to receive(action) subject.call(task) end end context "with other action" do let(:action) { Class.new } it "instantiates and calls" do expect_any_instance_of(action).to receive(:call).with(task) subject.call(task) end end it "yields" do expect { |spy| subject.call(task, &spy) }.to yield_control end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.6 | spec/middleware/dispatch_spec.rb |
wayfarer-0.4.5 | spec/middleware/dispatch_spec.rb |
wayfarer-0.4.4 | spec/middleware/dispatch_spec.rb |