Sha256: ebd9f721b30a4c718d2ea4fa1c780861b07561bacdfce1857a3206149b073cf3

Contents?: true

Size: 722 Bytes

Versions: 9

Compression:

Stored size: 722 Bytes

Contents

require 'spec_helper'

module EndState
  describe Guard do
    subject(:guard) { Guard.new(object, state, params) }
    let(:object) { Struct.new('Machine', :failure_messages, :success_messages, :state, :store_states_as_strings).new }
    let(:state) { :a }
    let(:params) { {} }
    before do
      object.failure_messages = []
      object.success_messages = []
    end

    describe '#add_error' do
      it 'adds an error' do
        guard.add_error('error')
        expect(object.failure_messages).to eq ['error']
      end
    end

    describe '#add_success' do
      it 'adds an success' do
        guard.add_error('success')
        expect(object.failure_messages).to eq ['success']
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
end_state-0.12.0 spec/end_state/guard_spec.rb
end_state-0.11.0 spec/end_state/guard_spec.rb
end_state-0.10.1 spec/end_state/guard_spec.rb
end_state-0.10.0 spec/end_state/guard_spec.rb
end_state-0.9.0 spec/end_state/guard_spec.rb
end_state-0.4.0 spec/end_state/guard_spec.rb
end_state-0.3.2 spec/end_state/guard_spec.rb
end_state-0.3.1 spec/end_state/guard_spec.rb
end_state-0.3.0 spec/end_state/guard_spec.rb