Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support_specs/helpers/migrations_helpers_spec.rb')
-rw-r--r--spec/support_specs/helpers/migrations_helpers_spec.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/support_specs/helpers/migrations_helpers_spec.rb b/spec/support_specs/helpers/migrations_helpers_spec.rb
index 5d44dac8eb7..2af16151350 100644
--- a/spec/support_specs/helpers/migrations_helpers_spec.rb
+++ b/spec/support_specs/helpers/migrations_helpers_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe MigrationsHelpers do
+RSpec.describe MigrationsHelpers, feature_category: :database do
let(:helper_class) do
Class.new.tap do |klass|
klass.include described_class
@@ -71,4 +71,40 @@ RSpec.describe MigrationsHelpers do
end
end
end
+
+ describe '#reset_column_information' do
+ context 'with a regular ActiveRecord model class' do
+ let(:klass) { Project }
+
+ it 'calls reset_column_information' do
+ expect(klass).to receive(:reset_column_information)
+
+ helper.reset_column_information(klass)
+ end
+ end
+
+ context 'with an anonymous class with table name defined' do
+ let(:klass) do
+ Class.new(ActiveRecord::Base) do
+ self.table_name = :projects
+ end
+ end
+
+ it 'calls reset_column_information' do
+ expect(klass).to receive(:reset_column_information)
+
+ helper.reset_column_information(klass)
+ end
+ end
+
+ context 'with an anonymous class with no table name defined' do
+ let(:klass) { Class.new(ActiveRecord::Base) }
+
+ it 'does not call reset_column_information' do
+ expect(klass).not_to receive(:reset_column_information)
+
+ helper.reset_column_information(klass)
+ end
+ end
+ end
end