Sha256: 57ce59a3b23786dc2df06cd48bb3b89d0454f4280b0e0b0b639b6100f84aa929

Contents?: true

Size: 837 Bytes

Versions: 16

Compression:

Stored size: 837 Bytes

Contents

require_relative 'test_helper'
require 'stringio'

class MachineWithConflictingStateNameTest < BaseTestCase
  def setup
    @original_stderr, $stderr = $stderr, StringIO.new

    @model = new_model
  end

  def test_should_output_warning_with_same_machine_name
    @machine = StateMachines::Machine.new(@model)
    @machine.state :state

    assert_match(/^Instance method "state\?" is already defined in Foo, use generic helper instead.*\n$/, $stderr.string)
  end

  def test_should_output_warning_with_same_machine_attribute
    @machine = StateMachines::Machine.new(@model, :public_state, :attribute => :state)
    @machine.state :state

    assert_match(/^Instance method "state\?" is already defined in Foo, use generic helper instead.*\n$/, $stderr.string)
  end

  def teardown
    $stderr = @original_stderr
    super
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

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