blob: f81fa692b388fc9f1a2325182b8e7e0d5e8f5692 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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).to have_content "Settings / Taxes / TaxJar Settings"
within(:css, "[data-hook=\"admin_settings_sub_tabs\"]") do
expect(page).to have_content("Taxes")
end
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
|