Sha256: 21a03aba69992f08c45ade43c03bab3ccf425f3969e3491655edd37e47de06be

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe DispatchRider::Callbacks::Storage do
  subject { described_class.new }

  describe "adding callbacks" do
    let!(:log) { [] }
    let(:actual) { proc { log << :actual } }

    describe "#around" do
      example do
        subject.around(:initialize) do |job|
          log << :abefore
          job.call
          log << :aafter
        end
        subject.for(:initialize).first[actual]
        expect(log).to eq %i[abefore actual aafter]
      end
    end

    describe "#before" do
      example do
        subject.before(:initialize) { log << :before }
        subject.for(:initialize).first[actual]
        expect(log).to eq %i[before actual]
      end
    end

    describe "#after" do
      example do
        subject.after(:initialize) { log << :after }
        subject.for(:initialize).first[actual]
        expect(log).to eq %i[actual after]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dispatch-rider-2.2.0 spec/lib/dispatch-rider/callbacks/storage_spec.rb