Skip to content

Commit de85a7e

Browse files
committed
Fix test
1 parent 103b5b3 commit de85a7e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/services/partners/request_create_service.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ def populate_item_request(partner_request)
118118

119119
if limit.present? && (quantity_requested > limit)
120120
message = if unit_type.blank?
121-
"#{item.name}: You requested #{quantity_requested}, but are limited to #{limit}"
122-
else
123-
"#{item.name}: You requested #{quantity_requested} #{unit_type&.pluralize}, but are limited to #{limit} #{unit_type&.pluralize}"
124-
end
121+
"#{item.name}: You requested #{quantity_requested}, but are limited to #{limit}"
122+
else
123+
"#{item.name}: You requested #{quantity_requested} #{unit_type&.pluralize}, but are limited to #{limit} #{unit_type&.pluralize}"
124+
end
125125
errors.add(:base, message)
126126
end
127127
end

spec/models/partners/item_request_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
item_request = build(:item_request, request_unit: "flat", request: request, item: item)
3838

3939
expect(item_request.valid?).to eq(false)
40-
expect(item_request.errors.full_messages).to eq(["Request unit is not supported"])
40+
expect(item_request.errors.full_messages).to eq(["flat is not a supported unit type"])
4141

4242
item_unit.update!(name: 'flat')
4343
item.reload

spec/models/request_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090

9191
it "is not valid" do
9292
expect(subject).to_not be_valid
93-
expect(subject.errors[:item_requests]).to include("should have unique item_ids")
93+
expect(subject.errors[:base]).to include("Please ensure a single unit is selected for each item that supports it")
9494
end
9595
end
9696

0 commit comments

Comments
 (0)