Sha256: b8fc0d05578bf6b20978e395056bae9b44f00970d11f5cbb2e4253216a8fe7b1

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 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_define_a_new_key_for_the_attribute
    refute_nil @model.fields['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

3 entries across 3 versions & 1 rubygems

Version Path
state_machines-mongoid-0.2.0 test/machine_with_non_column_state_attribute_undefined_test.rb
state_machines-mongoid-0.1.1 test/machine_with_non_column_state_attribute_undefined_test.rb
state_machines-mongoid-0.1.0 test/machine_with_non_column_state_attribute_undefined_test.rb