Commit 9671a67a authored by Felipe Artur's avatar Felipe Artur

Fix broken specs

parent d4a5d8d0
# frozen_string_literal: true
module IssuableStates
extend ActiveSupport::Concern
# The state:string column is being migrated to state_id:integer column
# This is a temporary hook to populate state_id column with new values
# and can be removed after the state column is removed.
# and should be removed after the state column is removed.
# Check https://gitlab.com/gitlab-org/gitlab-ce/issues/51789 for more information
included do
before_save :set_state_id
......@@ -12,6 +14,12 @@ module IssuableStates
def set_state_id
return if state.nil? || state.empty?
# Needed to prevent breaking some migration specs that
# rollback database to a point where state_id does not exist.
# We can use this guard clause for now since this file will should
# be removed in the next release.
return unless self.respond_to?(:state_id)
states_hash = self.class.available_states
self.state_id = states_hash[state]
......
......@@ -194,7 +194,7 @@ class MergeRequest < ActiveRecord::Base
end
def self.available_states
@states ||= super.merge(merged: 3, locked: 4)
@available_states ||= super.merge(merged: 3, locked: 4)
end
def rebase_in_progress?
......
# frozen_string_literal: true
class AddStateIdToIssuables < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
......
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