diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-05-23 00:25:26 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-05-23 00:25:26 +0800 |
commit | b3095251c4bd620e85cb22f9fc8b8c75bcbed4d4 (patch) | |
tree | 36cd4121006a3cf4a3c0832cc3af32bb2da45c1d | |
parent | a4407e75d374f65d8638d40eadbd0ec8c32cd6f6 (diff) | |
download | gitlab-ce-b3095251c4bd620e85cb22f9fc8b8c75bcbed4d4.tar.gz |
Make sure that Arel.sql would work for update_column_in_batchestest-update_column_in_batches-with-sql-mysql
-rw-r--r-- | spec/lib/gitlab/database/migration_helpers_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index dfa3ae9142e..bd5ac6142be 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -247,6 +247,14 @@ describe Gitlab::Database::MigrationHelpers, lib: true do expect(Project.where(archived: true).count).to eq(1) end end + + context 'when the value is Arel.sql (Arel::Nodes::SqlLiteral)' do + it 'updates the value as a SQL expression' do + model.update_column_in_batches(:projects, :star_count, Arel.sql('1+1')) + + expect(Project.sum(:star_count)).to eq(2 * Project.count) + end + end end describe '#add_column_with_default' do |