Sha256: f69ebf37add6eef6dba762c2f3c2a5ce6ee08e663621b35bd4395af531c2d68a

Contents?: true

Size: 465 Bytes

Versions: 14

Compression:

Stored size: 465 Bytes

Contents

require_relative '../../test_helper'

class CallbackWithIfConditionTest < StateMachinesTest
  def setup
    @object = Object.new
  end

  def test_should_call_if_true
    callback = StateMachines::Callback.new(:before, if: lambda { true }, do: lambda {})
    assert callback.call(@object)
  end

  def test_should_not_call_if_false
    callback = StateMachines::Callback.new(:before, if: lambda { false }, do: lambda {})
    refute callback.call(@object)
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/callback/callback_with_if_condition_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/callback/callback_with_if_condition_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/callback/callback_with_if_condition_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.4.0 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.3.0 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.2.2 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.2.1 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.2.0 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.1.4 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.1.3 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.1.2 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.1.1 test/unit/callback/callback_with_if_condition_test.rb
state_machines-0.1.0 test/unit/callback/callback_with_if_condition_test.rb