Sha256: abcaeb80d8ba2e8249db044fa1d3b141561a1f03fb1929b83006b060a970582c

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe 'error handling' do
  
  describe "for an input that can't be calculated" do
    it 'provides a message' do
      start
      type 'foo'
      type '5'
      type '4'
      type '+'
      type 'q'
  
      assert_exact_output <<-OUTPUT.rpc
        Cannot calculate 'foo'

        stack: 5.0
        aggregate: 0
        
        stack: 5.0, 4.0
        aggregate: 0
        
        calculated: 5.0 + 4.0
        stack: 
        aggregate: 9.0

      OUTPUT
    end
  end
  
  describe 'for a trigonometric method' do
    context 'that is called with a non-computable value' do
      it 'provides a message' do
        start
        type '5'
        type 'acos'
        type 'q'
  
        assert_exact_output <<-OUTPUT.rpc
          stack: 5.0
          aggregate: 0
        
          Bad value for 'acos'

        OUTPUT
      end
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reverse-polish-calculator-0.0.1 spec/acceptance/error_handling_spec.rb