Skip to content

Commit

Permalink
rename flag to DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
martyn-w committed Jul 11, 2024
1 parent 4a04a6c commit 5ba3107
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ GTM_ID=GTM-W3VGWP6
GTM_UA_ID=UA-136255210-1
BIGQUERY_DATASET=gse_events_production

DEGREE_SUBJECT_AUTOCOMPLETE=0
DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED=0
2 changes: 1 addition & 1 deletion .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ GTM_ID=GTM-PN3BPDM
GTM_UA_ID=UA-136255210-2
BIGQUERY_DATASET=gse_events_staging

DEGREE_SUBJECT_AUTOCOMPLETE=1
DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED=1
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Add public environment variables here for the Test environment
SECRET_KEY_BASE=stubbed

DEGREE_SUBJECT_AUTOCOMPLETE=1
DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED=1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def no_degree_subject
end

def degree_subject_autocomplete?
@degree_subject_autocomplete ||= ActiveModel::Type::Boolean.new.cast(ENV.fetch("DEGREE_SUBJECT_AUTOCOMPLETE", false))
@degree_subject_autocomplete ||= ActiveModel::Type::Boolean.new.cast(ENV.fetch("DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED", false))
end

private
Expand Down
8 changes: 4 additions & 4 deletions spec/services/candidates/registrations/education_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,26 @@
describe '#degree_subject_autocomplete?' do
before do
allow(ENV).to receive(:fetch).and_call_original
allow(ENV).to receive(:fetch).with("DEGREE_SUBJECT_AUTOCOMPLETE", false).and_return(degree_subject_autocomplete_flag)
allow(ENV).to receive(:fetch).with("DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED", false).and_return(degree_subject_autocomplete_flag)
end

context "when DEGREE_SUBJECT_AUTOCOMPLETE is not set" do
context "when DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED is not set" do
let(:degree_subject_autocomplete_flag) { nil }

it "returns false" do
expect(subject).not_to be_degree_subject_autocomplete
end
end

context "when DEGREE_SUBJECT_AUTOCOMPLETE=0" do
context "when DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED=0" do
let(:degree_subject_autocomplete_flag) { "0" }

it "returns false" do
expect(subject).not_to be_degree_subject_autocomplete
end
end

context "when DEGREE_SUBJECT_AUTOCOMPLETE=1" do
context "when DEGREE_SUBJECT_AUTOCOMPLETE_ENABLED=1" do
let(:degree_subject_autocomplete_flag) { "1" }

it "returns true" do
Expand Down

0 comments on commit 5ba3107

Please sign in to comment.