Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit ea47561

Browse files
committed
v3 - plan cost will not be shown when unit is empty string
[#172146647](https://www.pivotaltracker.com/story/show/172146647)
1 parent 7a8d9fd commit ea47561

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

app/presenters/v3/service_plan_presenter.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def costs_schema
148148
}
149149
},
150150
'unit' => {
151-
'type' => 'string'
151+
'type' => 'string',
152+
'minLength' => 1
152153
}
153154
}
154155
}

spec/unit/presenters/v3/service_plan_presenter_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,24 @@
317317
}
318318
]
319319
}'
320+
],
321+
['unit is empty string',
322+
'{
323+
"costs": [
324+
{
325+
"amount": {
326+
"gpb": 0.06
327+
},
328+
"unit": "Daily"
329+
},
330+
{
331+
"amount": {
332+
"usd": 0.10
333+
},
334+
"unit": ""
335+
}
336+
]
337+
}'
320338
]
321339
].each do |scenario, extra|
322340
it "returns empty cost array when #{scenario}" do

0 commit comments

Comments
 (0)