Sha256: 405db3c6d6e849af9a09f67a919e5148e1e5ab4ed1b6ea8f5835124723a0e0fe
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transitions-1.0.0 | test/state_transition/test_state_transition.rb |
transitions-0.2.1 | test/state_transition/test_state_transition.rb |