Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rails 4.1] Fix spec/models/spree/adjustment_spec.rb (4 broken specs) #5632

Closed
luisramos0 opened this issue Jun 17, 2020 · 2 comments
Closed
Assignees

Comments

@luisramos0
Copy link
Contributor

Broken specs in this build
https://semaphoreci.com/openfoodfoundation/openfoodnetwork-2/branches/pull-request-5611/builds/2

With this error:

 17) Spree::Adjustment recording included tax EnterpriseFee adjustments when enterprise fees have a fixed tax_category when enterprise fees are taxed per-item when the tax rate does not include the tax in the price records the tax on TaxRate adjustment on the order
      Failure/Error:
        per_item_fees_total = order.line_items.sum do |line_item|
          calculator.per_item_enterprise_fee_applicators_for(line_item.variant)
            .select { |applicator|
              (!applicator.enterprise_fee.inherits_tax_category && applicator.enterprise_fee.tax_category == rate.tax_category) ||
                (applicator.enterprise_fee.inherits_tax_category && line_item.product.tax_category == rate.tax_category)
            }
            .sum { |applicator| applicator.enterprise_fee.compute_amount(line_item) }
        end
      
      ArgumentError:
        wrong number of arguments (given 1, expected 2..3)
      # ./app/models/spree/calculator/default_tax_decorator.rb:19:in `compute_order'
      # ./app/models/spree/tax_rate_decorator.rb:15:in `adjust_with_included_tax'
      # ./spec/models/spree/adjustment_spec.rb:195:in `block (7 levels) in <module:Spree>'

Replacing sum with map and sum, fixes the specs:
image

This needs to be done after #5613 is merged to avoid conflicts.

@jeduardo824
Copy link
Contributor

jeduardo824 commented Aug 10, 2020

I will check it

@luisramos0
Copy link
Contributor Author

This has now been fixed. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants