Sha256: 6d8f89deba02b2d62c9c38966c5b69ba38965c938860e5f172aaa8f24159d393

Contents?: true

Size: 709 Bytes

Versions: 5

Compression:

Stored size: 709 Bytes

Contents

require_relative 'test_helper'
require 'stringio'

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

    @model = new_model do
      connection.add_column table_name, :status, :integer, :default => 1
    end
    @machine = StateMachines::Machine.new(@model, :status, :initial => :parked) do
      state :parked, :value => 1
    end
    @record = @model.new
  end

  def test_should_use_machine_default
    assert_equal 1, @record.status
  end

  def test_should_not_generate_a_warning
    assert_no_match(/have defined a different default/, $stderr.string)
  end

  def teardown
    $stderr = @original_stderr
    super
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
state_machines-activerecord-0.9.0 test/machine_with_same_integer_column_default_test.rb
state_machines-activerecord-0.8.0 test/machine_with_same_integer_column_default_test.rb
state_machines-activerecord-0.6.0 test/machine_with_same_integer_column_default_test.rb
state_machines-activerecord-0.5.2 test/machine_with_same_integer_column_default_test.rb
state_machines-activerecord-0.5.1 test/machine_with_same_integer_column_default_test.rb