diff options
| author | mo khan <mo@mokhan.ca> | 2016-12-25 10:33:15 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-12-25 10:33:15 -0700 |
| commit | bfd1055ca320f4c85bdc934b0cdb301256b23db2 (patch) | |
| tree | 7ec3f4537e8dc1af95a6a36e1f0e8ef64d9dd9c1 /spec | |
| parent | 86f0ded035303cee934f7c22fc79e32360e06878 (diff) | |
format quantity as json.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/quantity_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/quantity_spec.rb b/spec/models/quantity_spec.rb index e2a2623..85bc0bc 100644 --- a/spec/models/quantity_spec.rb +++ b/spec/models/quantity_spec.rb @@ -173,4 +173,13 @@ describe Quantity do expect(other).to be < quantity end end + + describe "#to_json" do + it 'format the amount and unit to json' do + expect(100.lbs.to_json).to eql({ + amount: 100.0, + unit: 'lbs', + }.to_json) + end + end end |
