diff options
author | Nicholas Van Doorn <vandoorn.nick@gmail.com> | 2021-02-01 16:57:32 -0800 |
---|---|---|
committer | Nicholas Van Doorn <vandoorn.nick@gmail.com> | 2021-02-08 15:10:34 -0800 |
commit | 338d38d00a3e444aaeddc757e508d0f34d811209 (patch) | |
tree | 14c1f3a3d59ec9df9eb7b601cbe146bf14ad3e2a /spec/super_good | |
parent | b8e1db2f128312b7d2a6923c2fe2424df70385c2 (diff) |
Include API version in request headers
TaxJar requires certified extensions to include an API version in the
header of each request. This extensions wraps the official TaxJar Ruby
Gem with another API client, so we make sure the version gets set in
when our wrapper class is constructed.
Co-authored-by: Noah Silvera <noah@super.gd>
Diffstat (limited to 'spec/super_good')
-rw-r--r-- | spec/super_good/solidus_taxjar/api_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/super_good/solidus_taxjar/api_spec.rb b/spec/super_good/solidus_taxjar/api_spec.rb index 7fab505..0244536 100644 --- a/spec/super_good/solidus_taxjar/api_spec.rb +++ b/spec/super_good/solidus_taxjar/api_spec.rb @@ -1,6 +1,23 @@ require "spec_helper" RSpec.describe SuperGood::SolidusTaxJar::API do + describe ".new" do + subject { described_class.new } + + let(:dummy_client) { instance_double ::Taxjar::Client } + + before do + ENV["TAXJAR_API_KEY"] = 'taxjar_api_token' + end + + it "puts the API version in the header" do + expect_any_instance_of(::Taxjar::Client).to receive(:set_api_config).with('headers', { + 'x-api-version' => '2020-08-07' + }) + subject + end + end + describe "#tax_for" do subject { api.tax_for order } |