Sha256: 1c62d50e541bc1ed8e26b3ce29ee0469b0fa4e91d68fe0dc5ef6c38b93a97798
Contents?: true
Size: 992 Bytes
Versions: 10
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true require "spec_helper" describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config do subject(:cop) { described_class.new(config) } let(:config) { RuboCop::Config.new } before { config["Discourse/NoResetColumnInformationInMigrations"]["Enabled"] = true } it "raises an offense if reset_column_information is used" do inspect_source(<<~RUBY) class SomeMigration < ActiveRecord::Migration[6.0] def up Post.reset_column_information end end RUBY expect(cop.offenses.first.message).to match(described_class::MSG) end it "raise an offense if reset_column_information is used without AR model" do inspect_source(<<~RUBY) class SomeMigration < ActiveRecord::Migration[6.0] def up "post".classify.constantize.reset_column_information end end RUBY expect(cop.offenses.first.message).to match(described_class::MSG) end end
Version data entries
10 entries across 10 versions & 1 rubygems