Files
discourse/spec/migrations/backfill_api_key_scope_modes_spec.rb
Ted Johansson f2365fd98b DEV: Backfill API key scope modes (#31606)
### What is this change?

Follow-up to #31601. This will be used for display in the admin API keys
UI.
2025-03-11 10:00:27 +08:00

22 lines
690 B
Ruby

# frozen_string_literal: true
require Rails.root.join("db/post_migrate/20250304074934_backfill_api_key_scope_modes.rb")
RSpec.describe BackfillApiKeyScopeModes do
describe "#up" do
fab!(:global_api_key)
fab!(:read_only_api_key)
fab!(:granular_api_key)
it "backfills with the correct scope modes" do
silence_stdout do
expect { described_class.new.up }.to change { read_only_api_key.reload.scope_mode }.from(
nil,
).to("read_only").and change { global_api_key.reload.scope_mode }.from(nil).to(
"global",
).and change { granular_api_key.reload.scope_mode }.from(nil).to("granular")
end
end
end
end