Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit fffbe61

Browse files
committed
Updates for Solidus >=1.3
Solidus 1.3 introduced persisted shipping rate taxes. This updates the shipping_rate spec to reflect the changes made in Solidus 1.3. Also makes sure that this extension not installs for Solidus v2.1, as it is not compatible to Solidus 2.1 yet.
1 parent 92a2d92 commit fffbe61

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ env:
55
matrix:
66
- SOLIDUS_BRANCH=v1.3 DB=mysql
77
- SOLIDUS_BRANCH=v1.3 DB=postgres
8-
- SOLIDUS_BRANCH=master DB=mysql
9-
- SOLIDUS_BRANCH=master DB=postgres
8+
- SOLIDUS_BRANCH=v1.4 DB=mysql
9+
- SOLIDUS_BRANCH=v1.4 DB=postgres
10+
- SOLIDUS_BRANCH=v2.0 DB=mysql
11+
- SOLIDUS_BRANCH=v2.0 DB=postgres
1012
script:
1113
- bundle exec rake test_app
1214
- bundle exec rspec

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source "https://rubygems.org"
22

3-
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
3+
branch = ENV.fetch('SOLIDUS_BRANCH', 'v1.4')
44
gem "solidus", github: "solidusio/solidus", branch: branch
55
gem "solidus_auth_devise", "~> 1.0"
66

solidus_avatax.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
1717
s.require_path = "lib"
1818
s.requirements << "none"
1919

20-
s.add_dependency "solidus_core", ">= 1.3.0.alpha", "< 1.4"
20+
s.add_dependency "solidus_core", ">= 1.3.0", "< 2.1"
2121
s.add_dependency "hashie", "~> 2.l.5"
2222
s.add_dependency "multi_json"
2323
s.add_dependency "Avatax_TaxService", "~> 2.0.0"
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
require 'spec_helper'
22

33
describe Spree::ShippingRate do
4+
let!(:tax_rate) do
5+
rate = Spree::TaxRate.first
6+
rate.zone.countries << shipment.order.ship_address.country
7+
rate
8+
end
9+
410
let(:shipping_rate) do
511
shipment.shipping_rates.create!({
6-
tax_rate: Spree::TaxRate.first,
712
shipping_method: shipping_method,
813
cost: 10.00,
9-
selected: true,
14+
selected: true
1015
})
1116
end
1217

1318
let(:shipment) { create(:shipment) }
14-
let(:shipping_method) { create(:shipping_method) }
19+
let(:shipping_method) { create(:shipping_method, tax_category: tax_rate.tax_category) }
20+
21+
before do
22+
Spree::Config.shipping_rate_taxer_class.new.tax(shipping_rate)
23+
end
1524

1625
it 'calculates shipping rate taxes as 0' do
17-
expect(shipping_rate.calculate_tax_amount).to eq 0
26+
expect(shipping_rate.taxes.first.amount).to eq 0
1827
end
1928
end

0 commit comments

Comments
 (0)