Commit d81597e0 authored by Sean McGivern's avatar Sean McGivern

Remove factories from IssuesMovedToIdForeignKey spec

parent b0668b34
require 'spec_helper' require 'spec_helper'
require Rails.root.join('db', 'migrate', '20171106151218_issues_moved_to_id_foreign_key.rb') require Rails.root.join('db', 'migrate', '20171106151218_issues_moved_to_id_foreign_key.rb')
# The schema version has to be far enough in advance to have the describe IssuesMovedToIdForeignKey, :migration do
# only_mirror_protected_branches column in the projects table to create a let(:issues) { table(:issues) }
# project via FactoryBot.
describe IssuesMovedToIdForeignKey, :migration, schema: 20171114150259 do let!(:issue_third) { issues.create! }
let!(:issue_first) { create(:issue, moved_to_id: issue_second.id) } # rubocop:disable RSpec/FactoriesInMigrationSpecs let!(:issue_second) { issues.create!(moved_to_id: issue_third.id) }
let!(:issue_second) { create(:issue, moved_to_id: issue_third.id) } # rubocop:disable RSpec/FactoriesInMigrationSpecs let!(:issue_first) { issues.create!(moved_to_id: issue_second.id) }
let!(:issue_third) { create(:issue) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
subject { described_class.new } subject { described_class.new }
it 'removes the orphaned moved_to_id' do it 'removes the orphaned moved_to_id' do
subject.down subject.down
issue_third.update(moved_to_id: 100000) issue_third.update!(moved_to_id: 0)
subject.up subject.up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment