Sha256: efd1d5d2d76b81dc1330848caec78cbb21b08b99ee8f133b5272e80625d3699e

Contents?: true

Size: 724 Bytes

Versions: 5

Compression:

Stored size: 724 Bytes

Contents

require 'test_helper'
require 'workflow'

class ComparableStatesOrder
  include Workflow
  workflow do
    state :submitted do
      event :accept, :transitions_to => :accepted, :meta => {:weight => 8} do |reviewer, args|
      end
    end
    state :accepted do
      event :ship, :transitions_to => :shipped
    end
    state :shipped
  end
end

class CompareStatesTest < Test::Unit::TestCase

  test 'compare states' do
    o = ComparableStatesOrder.new
    o.accept!
    assert_equal :accepted, o.current_state.name
    assert o.current_state == :accepted
    assert o.current_state < :shipped
    assert o.current_state > :submitted
    assert_raise ArgumentError do
      o.current_state > :unknown
    end
  end

end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
workflow-orchestrator-1.3.1 test/new_versions/compare_states_test.rb
workflow-orchestrator-1.3.0 test/new_versions/compare_states_test.rb
workflow-1.2.0 test/new_versions/compare_states_test.rb
workflow-1.1.0 test/new_versions/compare_states_test.rb
workflow-rails4-1.1.0 test/new_versions/compare_states_test.rb