tax_cloud 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/danger-comment.yml +18 -0
- data/.github/workflows/danger.yml +15 -0
- data/.github/workflows/lint.yml +29 -0
- data/.github/workflows/release.yml +27 -0
- data/.github/workflows/test.yml +29 -23
- data/.gitignore +1 -0
- data/.rubocop.yml +82 -6
- data/.rubocop_todo.yml +176 -23
- data/.spellcheck.txt +90 -0
- data/CHANGELOG.md +50 -61
- data/CONTRIBUTING.md +88 -0
- data/CONTRIBUTORS.txt +6 -6
- data/Dangerfile +7 -0
- data/Gemfile +16 -2
- data/LICENSE.md +3 -15
- data/README.md +48 -77
- data/RELEASING.md +39 -0
- data/Rakefile +22 -3
- data/lib/config/locales/en.yml +4 -0
- data/lib/tax_cloud/address.rb +3 -1
- data/lib/tax_cloud/errors/missing_cart_items_error.rb +13 -0
- data/lib/tax_cloud/errors/soap_error.rb +1 -1
- data/lib/tax_cloud/errors.rb +1 -0
- data/lib/tax_cloud/transaction.rb +4 -1
- data/lib/tax_cloud/version.rb +1 -1
- data/script/release.rb +15 -0
- data/tax_cloud.gemspec +1 -2
- data/test/cassettes/verify_bad_address.yml +772 -769
- data/test/cassettes/verify_good_address_with_rdi.yml +1650 -0
- data/test/test_address.rb +15 -0
- data/test/test_release.rb +82 -0
- data/test/test_transaction.rb +8 -0
- metadata +15 -3
data/test/test_address.rb
CHANGED
|
@@ -41,6 +41,21 @@ class TestAddress < TestSetup
|
|
|
41
41
|
assert_equal 'NY', verified.state
|
|
42
42
|
assert_equal '10001', verified.zip5
|
|
43
43
|
assert_equal '3502', verified.zip4
|
|
44
|
+
assert_nil verified.rdi
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_verify_good_address_with_rdi
|
|
49
|
+
VCR.use_cassette('verify good address with rdi') do
|
|
50
|
+
verified = @address.verify
|
|
51
|
+
assert_instance_of TaxCloud::Address, verified
|
|
52
|
+
assert_equal '888 6th Ave', verified.address1
|
|
53
|
+
assert_nil verified.address2
|
|
54
|
+
assert_equal 'New York', verified.city
|
|
55
|
+
assert_equal 'NY', verified.state
|
|
56
|
+
assert_equal '10001', verified.zip5
|
|
57
|
+
assert_equal '3502', verified.zip4
|
|
58
|
+
assert_equal 'Commercial', verified.rdi
|
|
44
59
|
end
|
|
45
60
|
end
|
|
46
61
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
|
|
6
|
+
Gem.loaded_specs.key?('ruby-gem-release')
|
|
7
|
+
require_relative '../script/release'
|
|
8
|
+
require 'ruby-gem-release/rspec'
|
|
9
|
+
|
|
10
|
+
# Runs the real release tasks against a local fixture, without contacting RubyGems or GitHub.
|
|
11
|
+
class TestRelease < Minitest::Test
|
|
12
|
+
include RubyGemRelease::RSpec
|
|
13
|
+
|
|
14
|
+
ROOT = File.expand_path('..', __dir__)
|
|
15
|
+
VERSION_PATH = 'lib/tax_cloud/version.rb'
|
|
16
|
+
FIXTURE_FILES = %w[
|
|
17
|
+
tax_cloud.gemspec script/release.rb lib/**/*.rb CHANGELOG.md LICENSE.md README.md RELEASING.md
|
|
18
|
+
].freeze
|
|
19
|
+
PLACEHOLDER = '* Your contribution here.'
|
|
20
|
+
NOTE = '* [#1](https://github.com/txcrb/tax_cloud/pull/1): Added a feature - [@dblock](https://github.com/dblock).'
|
|
21
|
+
|
|
22
|
+
def test_builds_the_standard_ruby_gem_release_workflow
|
|
23
|
+
assert_kind_of RubyGemRelease::Workflow::RubyGem, TaxCloudRelease.workflow
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_dates_the_release_and_prepares_the_next_patch_version
|
|
27
|
+
with_project(NOTE) do |project|
|
|
28
|
+
project.release!
|
|
29
|
+
|
|
30
|
+
released = project.remote_file('v1.2.0', 'CHANGELOG.md')
|
|
31
|
+
assert_match(%r{\A# Changelog\n\n## 1\.2\.0 \(\d{4}/\d{2}/\d{2}\)\n\n}, released)
|
|
32
|
+
assert_includes released, NOTE
|
|
33
|
+
refute_includes released, '(Next)'
|
|
34
|
+
refute_includes released, PLACEHOLDER
|
|
35
|
+
assert_includes project.remote_file('v1.2.0', VERSION_PATH), "VERSION = '1.2.0'"
|
|
36
|
+
|
|
37
|
+
pending = project.remote_file('master', 'CHANGELOG.md')
|
|
38
|
+
assert pending.start_with?("# Changelog\n\n## 1.2.1 (Next)\n\n#{PLACEHOLDER}\n\n## 1.2.0 ("), pending
|
|
39
|
+
assert_includes project.remote_file('master', VERSION_PATH), "VERSION = '1.2.1'"
|
|
40
|
+
assert_empty project.git('status', '--porcelain')
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_rejects_placeholder_only_notes_without_changing_files_or_remote_refs
|
|
45
|
+
with_project(nil) do |project|
|
|
46
|
+
original = project.git('rev-parse', 'origin/master')
|
|
47
|
+
project.run_task('release:workflow:capture')
|
|
48
|
+
|
|
49
|
+
error = assert_raises(RuntimeError) { project.run_task('release:validate') }
|
|
50
|
+
assert_match(/no pending changelog notes/, error.message)
|
|
51
|
+
assert_empty project.git('status', '--porcelain')
|
|
52
|
+
assert_equal original, project.git('rev-parse', 'origin/master')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def changelog(notes)
|
|
59
|
+
[
|
|
60
|
+
'# Changelog', '',
|
|
61
|
+
'## 1.2.0 (Next)', '', notes, PLACEHOLDER, '',
|
|
62
|
+
'## 1.1.0 (2026/01/01)', '', '* Previous release.', ''
|
|
63
|
+
].compact.join("\n")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def write_version(project, version)
|
|
67
|
+
source = File.read(File.join(ROOT, VERSION_PATH))
|
|
68
|
+
project.write(VERSION_PATH, source.sub(/VERSION = (['"])[^'"]+\1/, "VERSION = '#{version}'"))
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def with_project(notes)
|
|
72
|
+
with_release_project do |project|
|
|
73
|
+
project.copy_files(path: ROOT, files: FIXTURE_FILES)
|
|
74
|
+
project.configure_workflow(require: 'script/release', builder: 'TaxCloudRelease.workflow')
|
|
75
|
+
project.write('CHANGELOG.md', changelog(notes))
|
|
76
|
+
write_version(project, '1.2.0')
|
|
77
|
+
project.commit!
|
|
78
|
+
yield project
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
data/test/test_transaction.rb
CHANGED
|
@@ -30,6 +30,14 @@ class TestTransaction < TestSetup
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def test_lookup_without_cart_items
|
|
34
|
+
@transaction.cart_items = []
|
|
35
|
+
e = assert_raises TaxCloud::Errors::MissingCartItems do
|
|
36
|
+
@transaction.lookup
|
|
37
|
+
end
|
|
38
|
+
assert_equal 'Missing cart items.', e.problem
|
|
39
|
+
end
|
|
40
|
+
|
|
33
41
|
def test_authorized
|
|
34
42
|
VCR.use_cassette('authorized') do
|
|
35
43
|
@transaction.lookup
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tax_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Drew Tempelmeyer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -73,15 +73,23 @@ executables: []
|
|
|
73
73
|
extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
|
75
75
|
files:
|
|
76
|
+
- ".github/workflows/danger-comment.yml"
|
|
77
|
+
- ".github/workflows/danger.yml"
|
|
78
|
+
- ".github/workflows/lint.yml"
|
|
79
|
+
- ".github/workflows/release.yml"
|
|
76
80
|
- ".github/workflows/test.yml"
|
|
77
81
|
- ".gitignore"
|
|
78
82
|
- ".rubocop.yml"
|
|
79
83
|
- ".rubocop_todo.yml"
|
|
84
|
+
- ".spellcheck.txt"
|
|
80
85
|
- CHANGELOG.md
|
|
86
|
+
- CONTRIBUTING.md
|
|
81
87
|
- CONTRIBUTORS.txt
|
|
88
|
+
- Dangerfile
|
|
82
89
|
- Gemfile
|
|
83
90
|
- LICENSE.md
|
|
84
91
|
- README.md
|
|
92
|
+
- RELEASING.md
|
|
85
93
|
- Rakefile
|
|
86
94
|
- lib/config/locales/en.yml
|
|
87
95
|
- lib/hash.rb
|
|
@@ -95,6 +103,7 @@ files:
|
|
|
95
103
|
- lib/tax_cloud/configuration.rb
|
|
96
104
|
- lib/tax_cloud/errors.rb
|
|
97
105
|
- lib/tax_cloud/errors/api_error.rb
|
|
106
|
+
- lib/tax_cloud/errors/missing_cart_items_error.rb
|
|
98
107
|
- lib/tax_cloud/errors/missing_config_error.rb
|
|
99
108
|
- lib/tax_cloud/errors/missing_config_option_error.rb
|
|
100
109
|
- lib/tax_cloud/errors/soap_error.rb
|
|
@@ -123,6 +132,7 @@ files:
|
|
|
123
132
|
- lib/tax_cloud/tax_codes.rb
|
|
124
133
|
- lib/tax_cloud/transaction.rb
|
|
125
134
|
- lib/tax_cloud/version.rb
|
|
135
|
+
- script/release.rb
|
|
126
136
|
- tax_cloud.gemspec
|
|
127
137
|
- test/cassettes/authorized.yml
|
|
128
138
|
- test/cassettes/authorized_with_capture.yml
|
|
@@ -140,6 +150,7 @@ files:
|
|
|
140
150
|
- test/cassettes/returned.yml
|
|
141
151
|
- test/cassettes/verify_bad_address.yml
|
|
142
152
|
- test/cassettes/verify_good_address.yml
|
|
153
|
+
- test/cassettes/verify_good_address_with_rdi.yml
|
|
143
154
|
- test/helper.rb
|
|
144
155
|
- test/test_address.rb
|
|
145
156
|
- test/test_cart_item.rb
|
|
@@ -147,6 +158,7 @@ files:
|
|
|
147
158
|
- test/test_configuration_optional_keys.rb
|
|
148
159
|
- test/test_configuration_required_keys.rb
|
|
149
160
|
- test/test_lookup_response.rb
|
|
161
|
+
- test/test_release.rb
|
|
150
162
|
- test/test_setup.rb
|
|
151
163
|
- test/test_soap.rb
|
|
152
164
|
- test/test_tax_code_groups.rb
|
|
@@ -173,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
173
185
|
- !ruby/object:Gem::Version
|
|
174
186
|
version: 1.3.6
|
|
175
187
|
requirements: []
|
|
176
|
-
rubygems_version: 3.
|
|
188
|
+
rubygems_version: 3.5.22
|
|
177
189
|
signing_key:
|
|
178
190
|
specification_version: 4
|
|
179
191
|
summary: Calculate sales tax using TaxCloud
|