Sha256: d3975f0b79e914d7f2ef4d60ed9186da33f91e2bb548f00f0328f3a9defef327

Contents?: true

Size: 1.22 KB

Versions: 25

Compression:

Stored size: 1.22 KB

Contents

require "helper"

class TestStateTransition < Test::Unit::TestCase
  test "should set from, to, and opts attr readers" do
    opts = {:from => "foo", :to => "bar", :guard => "g"}
    st = Transitions::StateTransition.new(opts)

    assert_equal opts[:from], st.from
    assert_equal opts[:to],   st.to
    assert_equal opts,        st.options
  end

  test "should pass equality check if from and to are the same" do
    opts = {:from => "foo", :to => "bar", :guard => "g"}
    st = Transitions::StateTransition.new(opts)

    obj = stub
    obj.stubs(:from).returns(opts[:from])
    obj.stubs(:to).returns(opts[:to])

    assert_equal st, obj
  end

  test "should fail equality check if from are not the same" do
    opts = {:from => "foo", :to => "bar", :guard => "g"}
    st = Transitions::StateTransition.new(opts)

    obj = stub
    obj.stubs(:from).returns("blah")
    obj.stubs(:to).returns(opts[:to])

    assert_not_equal st, obj
  end

  test "should fail equality check if to are not the same" do
    opts = {:from => "foo", :to => "bar", :guard => "g"}
    st = Transitions::StateTransition.new(opts)

    obj = stub
    obj.stubs(:from).returns(opts[:from])
    obj.stubs(:to).returns("blah")

    assert_not_equal st, obj
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
transitions-0.2.0 test/state_transition/test_state_transition.rb
transitions-0.1.13 test/state_transition/test_state_transition.rb
transitions-0.1.12 test/state_transition/test_state_transition.rb
transitions-0.1.11 test/state_transition/test_state_transition.rb
transitions-0.1.10 test/state_transition/test_state_transition.rb
transitions-0.1.9 test/state_transition/test_state_transition.rb
transitions-0.1.8 test/state_transition/test_state_transition.rb
transitions-0.1.7 test/state_transition/test_state_transition.rb
transitions-0.1.6 test/state_transition/test_state_transition.rb
transitions-0.1.5 test/state_transition/test_state_transition.rb
transitions-0.1.4 test/state_transition/test_state_transition.rb
transitions-0.1.3 test/state_transition/test_state_transition.rb
transitions-0.1.2 test/state_transition/test_state_transition.rb
transitions-0.1.1 test/state_transition/test_state_transition.rb
transitions-0.1.0 test/test_state_transition.rb
transitions-0.0.18 test/test_state_transition.rb
transitions-0.0.17 test/test_state_transition.rb
transitions-0.0.16 test/test_state_transition.rb
transitions-0.0.14 test/test_state_transition.rb
transitions-0.0.13 test/test_state_transition.rb