Sha256: a13d0f06f1051333c25057aa5085b573641fc87fc78b35c569cc7f11890575e8

Contents?: true

Size: 619 Bytes

Versions: 11

Compression:

Stored size: 619 Bytes

Contents

require "helper"

class Bus
  include Transitions

  state_machine do
    state :parking
  end
end

class TestStatePredicateMethod < Test::Unit::TestCase
  def setup
    @bus = Bus.new
  end

  test "should generate predicate methods for states" do
    assert_true @bus.respond_to?(:parking?)
    assert_true @bus.send(:parking?)
  end

  test 'should raise `InvalidMethodOverride` if we try to overwrite existing methods' do
    assert_raise(Transitions::InvalidMethodOverride) do
      Class.new do
        include Transitions

        state_machine do
          state :frozen
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
transitions-0.2.0 test/state/test_state_predicate_method.rb
transitions-0.1.13 test/state/test_state_predicate_method.rb
transitions-0.1.12 test/state/test_state_predicate_method.rb
transitions-0.1.11 test/state/test_state_predicate_method.rb
transitions-0.1.10 test/state/test_state_predicate_method.rb
transitions-0.1.9 test/state/test_state_predicate_method.rb
transitions-0.1.8 test/state/test_state_predicate_method.rb
transitions-0.1.7 test/state/test_state_predicate_method.rb
transitions-0.1.6 test/state/test_state_predicate_method.rb
transitions-0.1.5 test/state/test_state_predicate_method.rb
transitions-0.1.4 test/state/test_state_predicate_method.rb