Sha256: ee2a5d81cee88b7781a8591055e679806ebb29c261cdb80aa4bb4728d8a99f98

Contents?: true

Size: 556 Bytes

Versions: 10

Compression:

Stored size: 556 Bytes

Contents

require "spec_helper"

describe Statesman::Guard do
  let(:callback) { -> {} }
  let(:guard) { described_class.new(from: nil, to: nil, callback: callback) }

  specify { expect(guard).to be_a(Statesman::Callback) }

  describe "#call" do
    subject(:call) { guard.call }

    context "success" do
      let(:callback) { -> { true } }

      specify { expect { call }.to_not raise_error }
    end

    context "error" do
      let(:callback) { -> { false } }

      specify { expect { call }.to raise_error(Statesman::GuardFailedError) }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
statesman-5.2.0 spec/statesman/guard_spec.rb
statesman-5.1.0 spec/statesman/guard_spec.rb
statesman-5.0.0 spec/statesman/guard_spec.rb
statesman-4.1.4 spec/statesman/guard_spec.rb
statesman-4.1.3 spec/statesman/guard_spec.rb
statesman-4.1.2 spec/statesman/guard_spec.rb
statesman-4.1.1 spec/statesman/guard_spec.rb
statesman-4.1.0 spec/statesman/guard_spec.rb
statesman-4.0.0 spec/statesman/guard_spec.rb
statesman-3.5.0 spec/statesman/guard_spec.rb