Sha256: 2f3bb059c8d079cbba64319157782ac5b4266912611ba2a2fc683e5ca7ffb2f7

Contents?: true

Size: 911 Bytes

Versions: 5

Compression:

Stored size: 911 Bytes

Contents

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]
        log.should == [:abefore, :actual, :aafter]
      end
    end

    describe "#before" do
      example do
        subject.before(:initialize) { log << :before }
        subject.for(:initialize).first[actual]
        log.should == [:before, :actual]
      end
    end

    describe "#after" do
      example do
        subject.after(:initialize) { log << :after }
        subject.for(:initialize).first[actual]
        log.should == [:actual, :after]
      end
    end

  end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dispatch-rider-1.5.3 spec/lib/dispatch-rider/callbacks/storage_spec.rb
dispatch-rider-1.5.2 spec/lib/dispatch-rider/callbacks/storage_spec.rb
dispatch-rider-1.5.1 spec/lib/dispatch-rider/callbacks/storage_spec.rb
dispatch-rider-1.5.0 spec/lib/dispatch-rider/callbacks/storage_spec.rb
dispatch-rider-1.4.2 spec/lib/dispatch-rider/callbacks/storage_spec.rb