summaryrefslogtreecommitdiff
path: root/spec/super_good
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-02-05 11:41:54 -0800
committerJared Norman <jared@super.gd>2019-02-05 11:41:54 -0800
commite84242c299bd3e3da74f472ab0c5b8f0a469e788 (patch)
tree4b74b1fec425dd2ef235010a17a23ebc13cdc903 /spec/super_good
parent4f7bd65748a251e881cfdf54bab1b7513ada24da (diff)
Add specs for config
Diffstat (limited to 'spec/super_good')
-rw-r--r--spec/super_good/solidus_taxjar_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/super_good/solidus_taxjar_spec.rb b/spec/super_good/solidus_taxjar_spec.rb
index 6195fff..4586f39 100644
--- a/spec/super_good/solidus_taxjar_spec.rb
+++ b/spec/super_good/solidus_taxjar_spec.rb
@@ -1,5 +1,40 @@
+require 'spec_helper'
+
RSpec.describe SuperGood::SolidusTaxJar do
it "has a version number" do
expect(SuperGood::SolidusTaxJar::VERSION).not_to be nil
end
+
+ describe "configuration" do
+ describe ".discount_calculator" do
+ subject { described_class.discount_calculator }
+ it { is_expected.to eq SuperGood::SolidusTaxJar::DiscountCalculator }
+ end
+
+ describe ".test_mode" do
+ subject { described_class.test_mode }
+ it { is_expected.to eq false }
+ end
+
+ describe ".exception_handler" do
+ subject { described_class.exception_handler.(exception) }
+
+ let(:exception) { StandardError.new("Something happened") }
+
+ it "reports the exception using the Rails logger" do
+ expect(Rails.logger).to receive(:error).with(
+ "An error occurred while fetching TaxJar tax rates - Something happened: Something happened"
+ )
+ subject
+ end
+ end
+
+ describe ".taxable_address_check" do
+ subject { described_class.taxable_address_check.(address) }
+
+ let(:address) { Spree::Address.new }
+
+ it { is_expected.to eq true }
+ end
+ end
end