Skip to content

Commit

Permalink
Improve wizard code and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie committed Jul 9, 2024
1 parent c8893c5 commit b4addf2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<% row.with_key(text: User.human_attribute_name(:first_name)) %>
<% row.with_value(text: @wizard.steps[:user].first_name) %>
<% row.with_action(text: t(".change"),
href: back_link_path,
href: step_path(:user),
html_attributes: {
class: "govuk-link--no-visited-state",
}) %>
Expand All @@ -24,7 +24,7 @@
<% row.with_key(text: User.human_attribute_name(:last_name)) %>
<% row.with_value(text: @wizard.steps[:user].last_name) %>
<% row.with_action(text: t(".change"),
href: back_link_path,
href: step_path(:user),
html_attributes: {
class: "govuk-link--no-visited-state",
}) %>
Expand All @@ -33,7 +33,7 @@
<% row.with_key(text: User.human_attribute_name(:email)) %>
<% row.with_value(text: @wizard.steps[:user].email) %>
<% row.with_action(text: t(".change"),
href: back_link_path,
href: step_path(:user),
html_attributes: {
class: "govuk-link--no-visited-state",
}) %>
Expand Down
4 changes: 1 addition & 3 deletions app/wizards/placements/add_user_wizard/user_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ def new_membership
end

def user
@user ||= begin
user = Placements::User.find_or_initialize_by(email:)
@user ||= Placements::User.find_or_initialize_by(email:).tap do |user|
user.assign_attributes(first_name:, last_name:)
user
end
end

Expand Down
1 change: 0 additions & 1 deletion config/locales/en/activemodel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ en:
blank: Enter an email address
taken: Email address already in use
invalid: Enter an email address in the correct format, like [email protected]
invalid_support_email: Enter a Department for Education email address in the correct format, like [email protected]
claims/claim/mentor_training_form:
attributes:
custom_hours_completed:
Expand Down
4 changes: 2 additions & 2 deletions spec/wizards/placements/add_user_wizard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
context "when the organisation is a provider" do
let(:organisation) { create(:placements_provider) }

it "creates a new user, and a membership between the user and school" do
it "creates a new user, and a membership between the user and provider" do
expect { wizard.create_user }.to change(
Placements::User, :count
).by(1).and change(UserMembership, :count).by(1)
Expand All @@ -73,7 +73,7 @@
context "when the organisation is a provider" do
let(:organisation) { create(:placements_provider) }

it "creates a membership between the user and school" do
it "creates a membership between the user and provider" do
expect { wizard.create_user }.to not_change(
Placements::User, :count
).and change(UserMembership, :count).by(1)
Expand Down

0 comments on commit b4addf2

Please sign in to comment.