diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-28 21:15:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-28 21:15:00 +0300 |
commit | 14059114eb35b29cf83aa1b715158c96c55ab388 (patch) | |
tree | b9b96e6bb66e3b1caf900bdce664a234087a4848 /spec/support_specs | |
parent | ee7db70e1185876e97eca97ce8efabfc64c360b9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs')
-rw-r--r-- | spec/support_specs/helpers/migrations_helpers_spec.rb | 38 |
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 |