Sha256: fffcc7939454d93ee37d378bfe2c3e650fbcceef3a4295b665c9cfcf81f756e5

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

module EndState
  module Concluders
    describe Persistence do
      subject(:concluder) { Persistence.new(object, state, params) }
      let(:object) { double :object, save: nil }
      let(:state) { :b }
      let(:params) { {} }

      describe '#call' do
        it 'calls save on the object' do
          concluder.call
          expect(object).to have_received(:save)
        end

        context 'when the object does not respond to save' do
          let(:object) { Object.new }

          it 'returns false' do
            expect(concluder.call).to be false
          end
        end
      end

      describe '#rollback' do
        it 'calls save on the object' do
          concluder.rollback
          expect(object).to have_received(:save)
        end

        context 'when the object does not respond to save' do
          let(:object) { Object.new }

          it 'returns true' do
            expect(concluder.rollback).to be true
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
end_state-1.1.2 spec/end_state/concluders/persistence_spec.rb
end_state-1.1.1 spec/end_state/concluders/persistence_spec.rb
end_state-1.1.0 spec/end_state/concluders/persistence_spec.rb
end_state-1.0.2 spec/end_state/concluders/persistence_spec.rb
end_state-1.0.1 spec/end_state/concluders/persistence_spec.rb
end_state-1.0.0 spec/end_state/concluders/persistence_spec.rb
end_state-0.12.0 spec/end_state/concluders/persistence_spec.rb
end_state-0.11.0 spec/end_state/concluders/persistence_spec.rb