Sha256: 32c78773c4a80d41c3133a10cb49a60fe1e89fc2bd6ca63273527da10f4dd201
Contents?: true
Size: 750 Bytes
Versions: 12
Compression:
Stored size: 750 Bytes
Contents
require 'helper' class Animal < ActiveRecord::Base acts_as_list default_scope -> { select(:name) } end class DefaultScopeWithSelectTest < Minitest::Test def setup ActiveRecord::Base.connection.create_table :animals do |t| t.column :position, :integer t.column :name, :string end ActiveRecord::Base.connection.schema_cache.clear! Animal.reset_column_information super end def teardown teardown_db super end def test_default_scope_with_select animal1 = Animal.create name: 'Fox' animal2 = Animal.create name: 'Panda' animal3 = Animal.create name: 'Wildebeast' assert_equal 1, animal1.position assert_equal 2, animal2.position assert_equal 3, animal3.position end end
Version data entries
12 entries across 12 versions & 1 rubygems