Sha256: 8e007d953de285b19b1eea1e67201533598e3eb5de541d7310604a61242dd066

Contents?: true

Size: 576 Bytes

Versions: 16

Compression:

Stored size: 576 Bytes

Contents

require_relative 'test_helper'

class MachineErrorsTest < BaseTestCase
  def setup
    @model = new_model
    @machine = StateMachines::Machine.new(@model)
    @record = @model.new
  end

  def test_should_be_able_to_describe_current_errors
    @record.errors.add(:id, 'cannot be blank')
    @record.errors.add(:state, 'is invalid')
    assert_equal ['Id cannot be blank', 'State is invalid'], @machine.errors_for(@record).split(', ').sort
  end

  def test_should_describe_as_halted_with_no_errors
    assert_equal 'Transition halted', @machine.errors_for(@record)
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
state_machines-activerecord-0.9.0 test/machine_errors_test.rb
state_machines-activerecord-0.8.0 test/machine_errors_test.rb
state_machines-activerecord-0.6.0 test/machine_errors_test.rb
state_machines-activerecord-0.5.2 test/machine_errors_test.rb
state_machines-activerecord-0.5.1 test/machine_errors_test.rb
state_machines-activerecord-0.5.0 test/machine_errors_test.rb
state_machines-activerecord-0.4.1 test/machine_errors_test.rb
state_machines-activerecord-0.4.0 test/machine_errors_test.rb
state_machines-activerecord-0.4.0.pre test/machine_errors_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-activerecord-0.2.0/test/machine_errors_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-activerecord-0.2.0/test/machine_errors_test.rb
state_machines-activerecord-0.3.0 test/machine_errors_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-activerecord-0.2.0/test/machine_errors_test.rb
state_machines-activerecord-0.2.0 test/machine_errors_test.rb
state_machines-activerecord-0.1.0 test/machine_errors_test.rb
state_machines-activerecord-0.0.1 test/machine_errors_test.rb