Commit 2b89af62 authored by Doug Barrett's avatar Doug Barrett 🔴
Browse files

refactor(fields): Update deprecated field mappings for GL_USER_ID

Change deprecated field names from meta.user_id to user_id and userid.
Update tests to use the new deprecated field names.
parent 1f0d0771
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ module Labkit
      # to identify and track usage of deprecated fields in the codebase.

      MAPPINGS = {
        Fields::GL_USER_ID => ["meta.user_id"],
        Fields::GL_USER_ID => ["user_id", "userid"],
      }.freeze

      class << self
+3 −3
Original line number Diff line number Diff line
@@ -19,13 +19,13 @@ RSpec.describe Labkit::Fields do
      end

      it 'maps deprecated fields to their standard equivalents' do
        expect(described_class.all['meta.user_id']).to eq(Labkit::Fields::GL_USER_ID)
        expect(described_class.all['user_id']).to eq(Labkit::Fields::GL_USER_ID)
      end
    end

    describe '.deprecated?' do
      it 'returns true for a known deprecated field' do
        result = described_class.deprecated?('meta.user_id')
        result = described_class.deprecated?('user_id')
        expect(result).to be(true)
      end

@@ -37,7 +37,7 @@ RSpec.describe Labkit::Fields do

    describe '.standard_field_for' do
      it 'returns a standard field for a known deprecated field' do
        result = described_class.standard_field_for('meta.user_id')
        result = described_class.standard_field_for('user_id')
        expect(result).to be(Labkit::Fields::GL_USER_ID)
      end
    end