Skip to content

Commit

Permalink
[rubyforgood#3052] Maintain partner request service and system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabar committed Jul 19, 2024
1 parent 636d50a commit 18d714a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 0 additions & 4 deletions app/services/partners/request_create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ def call
end
end

if @partner_request.comments.blank? && @partner_request.item_requests.blank?
errors.add(:base, 'completely empty request')
end

return self if errors.present?

Request.transaction do
Expand Down
12 changes: 10 additions & 2 deletions spec/system/partners/managing_requests_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@

context 'THEN a request records will be created' do
it "creates the correct request" do
expect { click_button 'Submit Essentials Request' }.to change { Request.count }.by(1)
click_button 'Submit Essentials Request'
expect(page).to have_selector('#partnerIndividualRequestConfirmationModal')
within "#partnerIndividualRequestConfirmationModal" do
click_button "Yes, it's correct"
end

created_request = Request.last
expected_items = item_details.map { |item| {"item_id" => item[:id], "quantity" => item[:quantity_per_person] * item[:person_count]} }
Expand Down Expand Up @@ -103,7 +107,11 @@

context 'THEN a request records will be created ' do
it "creates the correct request" do
expect { click_button 'Submit Essentials Request' }.to change { Request.count }.by(1)
click_button 'Submit Essentials Request'
expect(page).to have_selector('#partnerRequestConfirmationModal')
within "#partnerRequestConfirmationModal" do
click_button "Yes, it's correct"
end

created_request = Request.last
expected_items = item_details.map { |item| {"item_id" => item[:id], "quantity" => item[:quantity]} }
Expand Down

0 comments on commit 18d714a

Please sign in to comment.