solidusio-contrib / solidus_active_shipping

:package: Solidus integration for Shopify's active_shipping gem.
8 stars 22 forks source link

Restore the bogus carrier / calculator to unit test active_shipping/b… #2

Closed fredericboivin closed 8 years ago

fredericboivin commented 8 years ago

active_shipping_calculator_spec.rb is in a weird state since it's testing with a USPS calculators, who decorates the base methods like find_rates from active_shipping/base.rb

So this PR is to :

1) Restore the use of bogus carrier / calculator in the active_shipping_calculator_spec to unit tests the code present in active_shipping/base.rb

2) Extract the USPS specific code into a new carrier spec as a first step

jhawthorn commented 8 years ago

LGTM :+1:

forkata commented 8 years ago

@dangerdogz This is a great start for improving the tests. Aside from the few style comments I am :+1: on the direction for this.

fredericboivin commented 8 years ago

Good feeback. I share the style concerns and I'll get started on cleaning up with the new syntax

fredericboivin commented 8 years ago

I did a first pass on the active_shipping_spec, still need to sort the stock_location part but otherwise it looks better. I very much enjoy the process since learning to write good tests is definitely where I have the most work to do. (also cleaned it up a little with rubocop)

forkata commented 8 years ago

@dangerdogz That looks great. Thanks so much for all your work on this!

fredericboivin commented 8 years ago

I've cleaned up the stub usage in the usps spec since it was copy pasted from active_shipping_calculator_spec.

Since we're using a real calculator with a real carrier, the only thing we need to stub is the HTTP call since we're using a fixture.

Senjai commented 8 years ago

:+1: