Skip to content

Commit

Permalink
Update code to used Urn.next
Browse files Browse the repository at this point in the history
* startup.sh

* submitform service

* factories
  • Loading branch information
fumimowdan committed Sep 27, 2023
1 parent 72cda92 commit efce905
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/services/submit_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def create_application
date_of_entry: form.date_of_entry,
start_date: form.start_date,
subject: SubjectStep.new(form).answer.formatted_value,
urn: Urn.generate(form.application_route),
urn: Urn.next(form.application_route),
visa_type: form.visa_type,
)
end
Expand Down
2 changes: 2 additions & 0 deletions bin/app-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -e

# run migrations
bundle exec rails db:migrate
# Front load urn generation
bundle exec rake urn:generate

# add seed data in review environment
if [[ "$RAILS_ENV" = "review" || "$RAILS_ENV" = "development" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/applications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
visa_type { VisaStep::VALID_ANSWERS_OPTIONS.reject { _1 == "Other" }.sample }
date_of_entry { Time.zone.today }
start_date { 1.month.from_now.to_date }
urn { Urn.generate(application_route) }
urn { Urn.next(application_route) }

factory :teacher_application do
application_route { "teacher" }
Expand Down
2 changes: 1 addition & 1 deletion spec/services/submit_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

context "applicant email" do
before do
allow(Urn).to receive(:generate).and_return(urn)
allow(Urn).to receive(:next).and_return(urn)
end

let(:urn) { "SOMEURN" }
Expand Down

0 comments on commit efce905

Please sign in to comment.