mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
27 lines
686 B
Ruby
27 lines
686 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "cases/helper"
|
|
require "models/post"
|
|
|
|
module ActiveRecord
|
|
class SelectTest < ActiveRecord::TestCase
|
|
fixtures :posts
|
|
|
|
def test_select_with_nil_argument
|
|
expected = Post.select(:title).to_sql
|
|
assert_equal expected, Post.select(nil).select(:title).to_sql
|
|
end
|
|
|
|
def test_reselect
|
|
expected = Post.select(:title).to_sql
|
|
assert_equal expected, Post.select(:title, :body).reselect(:title).to_sql
|
|
end
|
|
|
|
def test_reselect_with_default_scope_select
|
|
expected = Post.select(:title).to_sql
|
|
actual = PostWithDefaultSelect.reselect(:title).to_sql
|
|
|
|
assert_equal expected, actual
|
|
end
|
|
end
|
|
end
|