From 3ab938897fe74c47c166ce97d26daf625326d0f0 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 29 Dec 2020 00:28:16 +0900 Subject: [PATCH] Update templates - Ransack does not Rails master branch aka 6.2.0.alpha yet - polyamorous is now part of ransack - sqlite3 adapter default boolean changed from `'t'/'f'` to `1/0` Refer https://github.com/rails/rails/commit/52e050ed00b023968fecda82f19a858876a7c435 - Apply RuboCop auto correct --- .../test-ransack-scope-and-column-same-name.rb | 5 ++--- .../test-ransacker-arel-present-predicate.rb | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bug_report_templates/test-ransack-scope-and-column-same-name.rb b/bug_report_templates/test-ransack-scope-and-column-same-name.rb index 47f9166..197cf24 100644 --- a/bug_report_templates/test-ransack-scope-and-column-same-name.rb +++ b/bug_report_templates/test-ransack-scope-and-column-same-name.rb @@ -12,14 +12,13 @@ unless File.exist?('Gemfile') source 'https://rubygems.org' # Rails master - gem 'rails', github: 'rails/rails' + gem 'rails', github: 'rails/rails', branch: '6-1-stable' # Rails last release # gem 'rails' gem 'sqlite3' gem 'ransack', github: 'activerecord-hackery/ransack' - gem 'polyamorous', github: 'activerecord-hackery/polyamorous' GEMFILE system 'bundle install' @@ -65,7 +64,7 @@ class BugTest < Minitest::Test sql = User.ransack({ activated: true }).result.to_sql puts sql assert_equal( - "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"active\" = 't'", sql + "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"active\" = 1", sql ) end diff --git a/bug_report_templates/test-ransacker-arel-present-predicate.rb b/bug_report_templates/test-ransacker-arel-present-predicate.rb index db49468..6939c20 100644 --- a/bug_report_templates/test-ransacker-arel-present-predicate.rb +++ b/bug_report_templates/test-ransacker-arel-present-predicate.rb @@ -10,14 +10,13 @@ unless File.exist?('Gemfile') source 'https://rubygems.org' # Rails master - gem 'rails', github: 'rails/rails' + gem 'rails', github: 'rails/rails', branch: '6-1-stable' # Rails last release # gem 'rails' gem 'sqlite3' gem 'ransack', github: 'activerecord-hackery/ransack' - gem 'polyamorous', github: 'activerecord-hackery/polyamorous' GEMFILE system 'bundle install' @@ -61,11 +60,11 @@ end class BugTest < Minitest::Test def test_ransackers - sql = Project.ransack({number_present: 1}).result.to_sql + sql = Project.ransack({ number_present: 1 }).result.to_sql puts sql assert_equal "SELECT \"projects\".* FROM \"projects\" WHERE (\"projects\".\"number\" IS NOT NULL AND \"projects\".\"number\" != '')", sql - sql = Project.ransack({name_present: 1}).result.to_sql + sql = Project.ransack({ name_present: 1 }).result.to_sql puts sql assert_equal "SELECT \"projects\".* FROM \"projects\" WHERE (projects.name IS NOT NULL AND projects.name != '')", sql end