Sha256: 61fe81266ba6b985f8ccfe373fa5b5ee89a4650f140e992f9af6c81d2e43212d

Contents?: true

Size: 1.21 KB

Versions: 26

Compression:

Stored size: 1.21 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'

class WithoutWorkflowTest < Test::Unit::TestCase
  class Article
    include Workflow
    workflow do
      state :new do
        event :submit, :transitions_to => :awaiting_review
      end
      state :awaiting_review do
        event :review, :transitions_to => :being_reviewed
      end
      state :being_reviewed do
        event :accept, :transitions_to => :accepted
        event :reject, :transitions_to => :rejected
      end
      state :accepted
      state :rejected
    end
  end

  def test_readme_example_article
    article = Article.new
    assert article.new?
  end

  test 'better error message on transitions_to typo' do
    assert_raise Workflow::WorkflowDefinitionError do
      Class.new do
        include Workflow
        workflow do
          state :new do
            event :event1, :transitionnn => :next # missing transitions_to target
          end
          state :next
        end
      end
    end
  end

  test 'check transition_to alias' do
    Class.new do
      include Workflow
      workflow do
        state :new do
          event :event1, :transition_to => :next
        end
        state :next
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 6 rubygems

Version Path
validating-workflow-0.7.12 test/without_active_record_test.rb
validating-workflow-0.7.11 test/without_active_record_test.rb
validating-workflow-0.7.10 test/without_active_record_test.rb
validating-workflow-0.7.9 test/without_active_record_test.rb
workflow-orchestrator-1.3.1 test/without_active_record_test.rb
workflow-orchestrator-1.3.0 test/without_active_record_test.rb
validating-workflow-0.7.7 test/without_active_record_test.rb
workflow-1.2.0 test/without_active_record_test.rb
validating-workflow-0.7.6 test/without_active_record_test.rb
workflow-1.1.0 test/without_active_record_test.rb
workflow-rails4-1.1.0 test/without_active_record_test.rb
workflow-1.0.0 test/without_active_record_test.rb
workflow-0.8.7 test/without_active_record_test.rb
workflow-0.8.6 test/without_active_record_test.rb
workflow-0.8.4 test/without_active_record_test.rb
workflow-0.8.3 test/without_active_record_test.rb
workflow-0.8.1 test/without_active_record_test.rb
railsware-workflow-0.8.1 test/without_active_record_test.rb
workflow-0.8.0 test/without_active_record_test.rb
validating-workflow-0.7.2 test/without_active_record_test.rb