diff options
author | Nicholas Van Doorn <nick@super.gd> | 2021-05-17 15:40:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 15:40:35 -0700 |
commit | 676adfa988317ef15ee412f230e1431648774ff4 (patch) | |
tree | 582fbb6a032f5fa9f518186a9892901f13e4c9a1 /spec/features/spree/admin/taxjar_settings_spec.rb | |
parent | 638179c4d8f525ed5a6df5bbef00885acb8dda50 (diff) | |
parent | 2578877729a441676712f83beade318ca6dfa944 (diff) |
Merge pull request #37 from Noah-Silvera/add-basic-taxjar-settings-ui
Add basic UI for Taxjar settings in solidus admin
Diffstat (limited to 'spec/features/spree/admin/taxjar_settings_spec.rb')
-rw-r--r-- | spec/features/spree/admin/taxjar_settings_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/features/spree/admin/taxjar_settings_spec.rb b/spec/features/spree/admin/taxjar_settings_spec.rb new file mode 100644 index 0000000..ae2e101 --- /dev/null +++ b/spec/features/spree/admin/taxjar_settings_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +RSpec.feature 'Admin TaxJar Settings', js: true do + stub_authorization! + + background do + create :store, default: true + end + + describe "Taxjar settings tab" do + before do + allow(ENV).to receive(:[]).and_call_original + allow(ENV).to receive(:[]).with("TAXJAR_API_KEY").and_return(api_token) + end + + context "Taxjar API token is set" do + let(:api_token) { "token" } + + it "shows a blank settings page" do + + visit "/admin" + click_on "Settings" + expect(page).to have_content("Taxes") + click_on "Taxes" + expect(page).to have_content("TaxJar Settings") + click_on "TaxJar Settings" + expect(page).not_to have_content "You must provide a TaxJar API token" + end + end + + context "Taxjar API token isn't set" do + let(:api_token) { nil } + + it "shows a descriptive error message" do + visit "/admin" + click_on "Settings" + expect(page).to have_content("Taxes") + click_on "Taxes" + expect(page).to have_content("TaxJar Settings") + click_on "TaxJar Settings" + expect(page).to have_content "You must provide a TaxJar API token" + + expect(page).to have_link(href: "https://app.taxjar.com/api_sign_up") + expect(page).to have_link(href: "https://support.taxjar.com/article/160-how-do-i-get-a-sales-tax-api-token") + end + end + end +end |