Sha256: f25885a03d48f7a2ae0dc4a72526600727aa551994efd066cadcd9f4ac3a1330

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

require_relative 'test_helper'

class MachineWithNonColumnStateAttributeUndefinedTest < BaseTestCase
  def setup
    @model = new_model do
      def initialize
        # Skip attribute initialization
        @initialized_state_machines = true
        super
      end
    end

    @machine = StateMachines::Machine.new(@model, :status, :initial => :parked)
    @machine.other_states(:idling)
    @record = @model.new
  end

  def test_should_not_define_a_column_for_the_attribute
    assert_nil @model.columns_hash['status']
  end

  def test_should_define_a_reader_attribute_for_the_attribute
    assert @record.respond_to?(:status)
  end

  def test_should_define_a_writer_attribute_for_the_attribute
    assert @record.respond_to?(:status=)
  end

  def test_should_define_an_attribute_predicate
    assert @record.respond_to?(:status?)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
state_machines-activerecord-0.0.1 test/machine_with_non_column_state_attribute_undefined_test.rb