|
187 | 187 | end
|
188 | 188 | end
|
189 | 189 |
|
190 |
| - describe "#adjust" do |
191 |
| - let(:taxable_address) { create(:address) } |
192 |
| - let(:order) { create(:order_with_line_items, ship_address: order_address) } |
193 |
| - let(:tax_zone) { create(:zone, countries: [taxable_address.country]) } |
194 |
| - let(:foreign_address) { create(:address, country_iso_code: "CA") } |
195 |
| - let!(:foreign_zone) { create(:zone, countries: [foreign_address.country]) } |
196 |
| - let(:tax_rate) do |
197 |
| - create(:tax_rate, |
198 |
| - included_in_price: included_in_price, |
199 |
| - show_rate_in_label: show_rate_in_label, |
200 |
| - amount: 0.125, |
201 |
| - zone: tax_zone) |
202 |
| - end |
203 |
| - |
204 |
| - let(:item) { order.line_items.first } |
205 |
| - |
206 |
| - before do |
207 |
| - expect(Spree::Deprecation).to receive(:warn). |
208 |
| - with(/^`Spree::TaxRate#adjust` is deprecated/, any_args) |
209 |
| - end |
210 |
| - |
211 |
| - describe 'adjustments' do |
212 |
| - before do |
213 |
| - tax_rate.adjust(nil, item) |
214 |
| - end |
215 |
| - |
216 |
| - let(:adjustment_label) { item.adjustments.tax.first.label } |
217 |
| - |
218 |
| - context 'for included rates' do |
219 |
| - let(:included_in_price) { true } |
220 |
| - let(:order_address) { taxable_address } |
221 |
| - |
222 |
| - context 'with show rate in label' do |
223 |
| - let(:show_rate_in_label) { true } |
224 |
| - |
225 |
| - it 'shows the rate in the label' do |
226 |
| - expect(adjustment_label).to include("12.500%") |
227 |
| - end |
228 |
| - |
229 |
| - it 'adds a remark that the rate is included in the price' do |
230 |
| - expect(adjustment_label).to include("Included in Price") |
231 |
| - end |
232 |
| - end |
233 |
| - |
234 |
| - context 'with show rate in label turned off' do |
235 |
| - let(:show_rate_in_label) { false } |
236 |
| - |
237 |
| - it 'does not show the rate in the label' do |
238 |
| - expect(adjustment_label).not_to include("12.500%") |
239 |
| - end |
240 |
| - |
241 |
| - it 'does not have two consecutive spaces' do |
242 |
| - expect(adjustment_label).not_to include(" ") |
243 |
| - end |
244 |
| - |
245 |
| - it 'adds a remark that the rate is included in the price' do |
246 |
| - expect(adjustment_label).to include("Included in Price") |
247 |
| - end |
248 |
| - end |
249 |
| - end |
250 |
| - |
251 |
| - context 'for additional rates' do |
252 |
| - let(:included_in_price) { false } |
253 |
| - let(:order_address) { taxable_address } |
254 |
| - |
255 |
| - context 'with show rate in label' do |
256 |
| - let(:show_rate_in_label) { true } |
257 |
| - |
258 |
| - it 'shows the rate in the label' do |
259 |
| - expect(adjustment_label).to include("12.500%") |
260 |
| - end |
261 |
| - |
262 |
| - it 'does not add a remark that the rate is included in the price' do |
263 |
| - expect(adjustment_label).not_to include("Included in Price") |
264 |
| - end |
265 |
| - end |
266 |
| - |
267 |
| - context 'with show rate in label turned off' do |
268 |
| - let(:show_rate_in_label) { false } |
269 |
| - |
270 |
| - it 'does not show the rate in the label' do |
271 |
| - expect(adjustment_label).not_to include("12.500%") |
272 |
| - end |
273 |
| - |
274 |
| - it 'does not add a remark that the rate is included in the price' do |
275 |
| - expect(adjustment_label).not_to include("Included in Price") |
276 |
| - end |
277 |
| - end |
278 |
| - end |
279 |
| - end |
280 |
| - end |
281 |
| - |
282 | 190 | describe "#active?" do
|
283 | 191 | subject(:rate) { create(:tax_rate, validity).active? }
|
284 | 192 |
|
|
0 commit comments