Last active
August 3, 2019 15:37
-
-
Save sinsoku/690b5495f07b1dbea7f40b492ba03c06 to your computer and use it in GitHub Desktop.
AR test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "rails", github: "rails/rails" | |
gem "sqlite3" | |
end | |
require "active_record" | |
require "minitest/autorun" | |
require "logger" | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :users, force: true do |t| | |
t.timestamps | |
end | |
end | |
class User < ActiveRecord::Base | |
end | |
puts | |
puts "RUBY_VERSION = #{RUBY_VERSION}" | |
puts "ActiveRecord.version = #{ActiveRecord.version}" | |
puts | |
class BugTest < Minitest::Test | |
def test_sample | |
puts User.where.not(id: (..1)).to_sql | |
end | |
end | |
=begin | |
以下が標準出力の内容 | |
RUBY_VERSION = 2.7.0 | |
ActiveRecord.version = 6.1.0.alpha | |
Run options: --seed 16057 | |
# Running: | |
SELECT "users".* FROM "users" WHERE NOT ("users"."id" <= 1) | |
. | |
Finished in 0.002369s, 422.1190 runs/s, 0.0000 assertions/s. | |
1 runs, 0 assertions, 0 failures, 0 errors, 0 skips | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment