Sha256: 9637ff44b742e7ed1b027dfd6a9a239dd4777572b224555f687cedd2bcdc9a6b

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

require "helper"

# Regression test for https://github.com/troessner/transitions/issues/95
class CreateSwitches < ActiveRecord::Migration
  def self.up
    create_table(:switches, :force => true) do |t|
      t.string :state
    end
  end
end

class Switch < ActiveRecord::Base
  include ActiveModel::Transitions

  state_machine do
    state :off
    state :on
  end
end

class TestCustomSelect < Test::Unit::TestCase
  def setup
    set_up_db CreateSwitches
    Switch.create!
  end

  test "should not trigger an exception when we use a custom select query which excludes the name of our state attribute" do
    result = Switch.select(:id)
    assert_nothing_raised NoMethodError do
      result.inspect
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transitions-0.2.0 test/active_record/test_custom_select.rb
transitions-0.1.13 test/active_record/test_custom_select.rb
transitions-0.1.12 test/active_record/test_custom_select.rb