diff options
author | Brendan Deere <brendan.g.deere@gmail.com> | 2016-12-20 11:31:01 -0800 |
---|---|---|
committer | Brendan Deere <brendan@stembolt.com> | 2017-01-06 14:35:58 -0800 |
commit | 0f48d548b978780f0ff54635056f60ffb7cfa62b (patch) | |
tree | f8e25fab9dfe6812eff4cb11273cd620c437a94a /app/models/solidus_subscriptions/order_builder.rb | |
parent | 76888eaa7622f32ba656bd1ccf6a46d1fd97d6fb (diff) |
Fix spec failures
Not really sure how this was correct before.
When the line item already existed on an order, the builder would
increment the quantity of the line item without saving it. in the specs,
a different instance of the line item would be tested resulting in the
change in quantity not being apparent to the spec
Diffstat (limited to 'app/models/solidus_subscriptions/order_builder.rb')
-rw-r--r-- | app/models/solidus_subscriptions/order_builder.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/app/models/solidus_subscriptions/order_builder.rb b/app/models/solidus_subscriptions/order_builder.rb index 2987bae..10fdc6c 100644 --- a/app/models/solidus_subscriptions/order_builder.rb +++ b/app/models/solidus_subscriptions/order_builder.rb @@ -31,8 +31,7 @@ module SolidusSubscriptions end if line_item - line_item.quantity += new_item.quantity - line_item.tap(&:save!) + line_item.increment!(:quantity, new_item.quantity) else order.line_items << new_item end |