Skip to content

Commit

Permalink
fix checking nil books_used_details (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
jivey authored Oct 5, 2023
1 parent e142ed9 commit 2b333ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/handlers/newflow/educator_signup/complete_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def books_used
end

def books_used_details
signup_params.books_used_details.reject do |k, v|
(signup_params.books_used_details || {}).reject do |k, v|
k.blank? || v.dig('how_using_book').blank? || v.dig('num_students_using_book').blank?
end
end
Expand Down
19 changes: 19 additions & 0 deletions spec/handlers/newflow/educator_signup/complete_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,25 @@ module EducatorSignup
}
end

context 'with a different profile' do
let(:params) do
{
signup: {
school_name: 'School Name',
books_of_interest: ['Test Book'],
books_used: ['Test Book'],
using_openstax_how: Newflow::EducatorSignup::CompleteProfile::AS_FUTURE,
educator_specific_role: Newflow::EducatorSignup::CompleteProfile::INSTRUCTOR,
}
}
end

it "should not error" do
result = handle
expect(result.errors.count).to eq 0
end
end

context 'books used details' do
let(:educator_specific_role) { Newflow::EducatorSignup::CompleteProfile::INSTRUCTOR }

Expand Down

0 comments on commit 2b333ba

Please sign in to comment.