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

Failing spec for calculator with preferences that aren't known #4005

Closed
wants to merge 1 commit into from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Mar 25, 2021

If you try accessing a calculator with preferences in the DB, and that
calculator hasn't seen the serialize call, Rails will try accessing
the preferences column directly and return a string :(

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

If you try accessing a calculator with preferences in the DB, and that
calculator hasn't seen the `serialize` call, Rails will try accessing
the preferences column directly and return a string :(

let!(:shipping_methods) do
[
create(:shipping_method, calculator: Spree::Calculator::Shipping::WithUnknownPreferences.new(preferences: {a: "b"}))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

@@ -105,7 +105,25 @@ def compute_package(_package)

let!(:shipping_methods) do
[
create(:shipping_method, calculator: Spree::Calculator::Shipping::NoPreferences.new)
create(:shipping_method, calculator: Spree::Calculator::Shipping::NoPreferences.new())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/MethodCallWithoutArgsParentheses: Do not use parentheses for method calls with no arguments.

@kennyadsl
Copy link
Member

Shouldn't those preferences be declared in the calculator with preference :a?

@mamhoff
Copy link
Contributor Author

mamhoff commented Mar 30, 2021

I've added this commit to #4013

@mamhoff mamhoff closed this Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants