David Cook
9a3820db4f
Tidy up spec
...
Although 'describe' and 'context' are the same simple constructs to label groups of examples, to humans they mean:
* Describe a particular domain of functionality
* Context means a different environment, IE something has been set up differently (generally with before and/or let blocks)
Also the default 'before' is :each, so we don't need to specify it.
2023-08-15 08:36:22 +02:00
David Cook
757ba27908
Optimise spec: only create objects when needed
...
Moving the 'clear filters' and 'no results' tests up into the first context.
2023-08-15 08:36:22 +02:00
David Cook
2a4d5af552
Remove redundant test
...
This is already covered in the following test.
2023-08-15 08:36:21 +02:00
Gaetan Craig-Riou
5a2155aeb7
Use the same sorting when choosing a line item to update
...
The presenter uses order.sorted_line_items, so use the same method
when picking up the line item to update.
2023-08-15 11:33:02 +10:00
Matt-Yorkley
97d9aadb69
Update specs
2023-08-14 21:02:48 +01:00
Matt-Yorkley
42d04b6581
Update OrderAvailableShippingMethods service
2023-08-14 21:02:47 +01:00
Matt-Yorkley
c18c525d9f
Save shipping category selection to new variant when creating a new product
2023-08-14 21:02:47 +01:00
Neal Chambers
ec49065739
Reword image_exists? to use Rails.public_path
2023-08-14 17:29:11 +09:00
Neal Chambers
94f1b89a9f
Safely autocorrect Rails/RootPublicPath
...
Inspecting 1484 files
.............................................................................................C........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.........................................................................................C..........C..........................................................................................................................................................................................................................................................................................................C....................................................................................................................................................................C...................C.............................................................C.C.......C....................
Offenses:
app/controllers/concerns/request_timeouts.rb:19:22: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
file: Rails.root.join("public/500.html"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/spree/core/controller_helpers/common.rb:45:30: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
file: Rails.root.join("public/404.html"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/controllers/api/v0/product_images_controller_spec.rb:13:22: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:pdf_path) { Rails.root.join("public/Terms-of-service.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/controllers/api/v0/terms_and_conditions_controller_spec.rb:15:31: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:terms_file_path) { Rails.root.join("public/Terms-of-service.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/terms_of_service_file_spec.rb:6:25: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:pdf) { File.open(Rails.root.join("public/Terms-of-service.pdf")) }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/admin/bulk_product_update_spec.rb:907:37: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
attach_file 'image-upload', Rails.root.join("public/500.jpg"), visible: false
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/admin/enterprises/terms_and_conditions_spec.rb:27:30: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:original_terms) { Rails.root.join("public/Terms-of-service.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/admin/enterprises/terms_and_conditions_spec.rb:28:29: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:updated_terms) { Rails.root.join("public/Terms-of-ServiceUK.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/consumer/shopping/checkout_spec.rb:94:9: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
Rails.root.join("public/Terms-of-service.pdf"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/consumer/shopping/embedded_groups_spec.rb:18:9: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
Rails.root.join("public/embedded-group-preview.html")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/consumer/shopping/embedded_groups_spec.rb:26:9: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
Rails.root.join("public/embedded-group-preview.html")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/consumer/split_checkout_spec.rb:986:35: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:system_terms_path) { Rails.root.join("public/Terms-of-service.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/system/consumer/split_checkout_spec.rb:987:33: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
let(:shop_terms_path) { Rails.root.join("public/Terms-of-ServiceUK.pdf") }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1484 files inspected, 13 offenses detected, 13 offenses corrected
2023-08-14 17:29:11 +09:00
Neal Chambers
aaf2181768
Safely autocorrect Rails/FilePath
...
Inspecting 1484 files
.............................................................................................................................................................................................................................................................................................................C.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C....................C.....................................................................................................................................................................................................................................................................C.........................................................................................................................................................................................................C...........................................................................................................................................................
Offenses:
app/models/product_import/product_importer.rb:290:35: C: [Corrected] Rails/FilePath: Prefer Rails.root.join('path/to').
return unless @file.path == Rails.root.join('tmp', 'product_import').to_s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/karma.rake:42:5: C: [Corrected] Rails/FilePath: Prefer Rails.root.join('path/to').
"#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH)}/translations.js"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/karma.rake:42:5: C: [Correctable] Style/RedundantInterpolation: Prefer to_s over string interpolation.
"#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH, 'translations.js')}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/karma.rake:42:59: C: [Corrected] Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
"#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH, "translations.js")}"
^^^^^^^^^^^^^^^^^
spec/base_spec_helper.rb:58:25: C: [Corrected] Rails/FilePath: Prefer Rails.root.join('path/to').
config.fixture_path = "#{::Rails.root}/spec/fixtures"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/base_spec_helper.rb:58:25: C: [Correctable] Style/RedundantInterpolation: Prefer to_s over string interpolation.
config.fixture_path = "#{Rails.root.join('spec/fixtures')}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/base_spec_helper.rb:58:44: C: [Corrected] Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
config.fixture_path = "#{Rails.root.join("spec/fixtures")}"
^^^^^^^^^^^^^^^
spec/models/content_configuration_spec.rb:15:19: C: [Corrected] Rails/FilePath: Prefer Rails.root.join('path/to').to_s.
File.exist?(File.join(Rails.root, 'public', default_url))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/content_configuration_spec.rb:15:19: C: [Corrected] Rails/RootPublicPath: Use Rails.public_path.
File.exist?(Rails.root.join('public', default_url).to_s)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/downloads_helper.rb:7:5: C: [Corrected] Rails/FilePath: Prefer Rails.root.join('path/to').
Rails.root.join("tmp", "capybara")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1484 files inspected, 10 offenses detected, 8 offenses corrected, 2 more offenses can be corrected with `rubocop -A`
2023-08-14 17:29:11 +09:00
Maikel Linke
91e4fb18ed
Use input labels in Voucher system spec
...
It's more robust, and closer to what the user sees and does. It's also
verifying that the labels are correctly connected to the inputs.
2023-08-14 12:46:13 +10:00
Maikel Linke
ba53f31309
Use new hash syntax in Voucher spec
2023-08-14 12:40:54 +10:00
Maikel Linke
160cdc7f8e
Clarify Voucher request spec not a controller spec
2023-08-14 12:25:56 +10:00
Maikel Linke
efe2dfff8e
Let Rails handle Voucher type building
2023-08-14 11:51:34 +10:00
Maikel Linke
4d5e1ffb3b
Simplify VouchersController with single param name
...
The Voucher form now deals with a generic Voucher instead of a subclass
which makes the naming easier and is less confusing when changing types.
2023-08-14 11:39:59 +10:00
Konrad
99daab07b7
Merge pull request #11297 from mkllnk/require-belongs-to--part2
...
Require belongs_to associations by default
2023-08-12 17:09:03 +02:00
Rachel Arnould
5afe45d922
Merge pull request #11382 from jibees/11273-buu-remove-new_products_page-feature-toggle
...
🔧 Remove `new_products_page` and all associated controllers/components/...
2023-08-11 11:43:49 +02:00
Gaetan Craig-Riou
06f986ff52
Allow for creating a voucher with either flat or percentage rate
...
In the scenario when you get an error when trying to create a
percentage voucher, on the subsequent try we would be dealing with
a "percentage rate voucher". The code now handle any type of voucher
2023-08-11 16:09:48 +10:00
Gaetan Craig-Riou
9c9a6234e1
Per review, clean up voucher specs
...
Add explicit 'order.item_total' to make specs more readable
2023-08-11 15:41:45 +10:00
Gaetan Craig-Riou
054eac0822
Use a better describe
...
Co-authored-by: David Cook <david@redcliffs.net >
2023-08-11 15:41:45 +10:00
Gaetan Craig-Riou
3f63cfbc27
Fix Rubocop warning
2023-08-11 15:41:45 +10:00
Gaetan Craig-Riou
e8b374d0f2
Remove left over comment
2023-08-11 15:41:45 +10:00
Gaetan Craig-Riou
2828bd098d
Refactor VoucherAdjustment service
...
We are taking advantage of having a FlatRate and a PercentageRate
model to simplify the code a little
2023-08-11 15:41:34 +10:00
Gaetan Craig-Riou
29a38467d2
Fix admin pages to work with refactored vouchers
2023-08-11 14:54:23 +10:00
Gaetan Craig-Riou
46e04ca7ee
Refactor voucher: 3 percentage rate voucher
2023-08-11 14:54:23 +10:00
Gaetan Craig-Riou
def594ab81
Refactor voucher: 2 FlatRate voucher
2023-08-11 14:54:23 +10:00
Gaetan Craig-Riou
204f3933d0
Refactor voucher: 1 base voucher class
...
Refactor voucher to use a single table inheritance. It will simplify the
code and remove a bunch of conditional
2023-08-11 14:54:23 +10:00
Gaetan Craig-Riou
959e2308dd
Add system specs for percentage based voucher
...
Similar to tax included in price scenario, adds a test for percentage
based voucher to check the adjustments are recalculated when needed.
Plus fix tax incluced in price specs to use new factory
2023-08-11 14:51:36 +10:00
Gaetan Craig-Riou
cdb33aa0d0
Add calculation for percentage voucher
...
It include calculation for order with taxes included in the price
2023-08-11 14:30:48 +10:00
Gaetan Craig-Riou
cc9069e9c6
Add voucher type to admin screen
...
Plus specs
2023-08-11 14:19:26 +10:00
Gaetan Craig-Riou
619285ad4a
Add voucher_type to voucher
...
And update related specs
voucher_type doesn't do anything for now.
2023-08-11 14:19:25 +10:00
Gaetan Craig-Riou
1be8daaf86
Add specs to cover re calculation
...
It is important that the calculated voucher adjustments don't change
if they are recalculated and it is equally important that they are
updated if the order has changed
2023-08-11 14:19:25 +10:00
Maikel Linke
a34a351cee
Stabilise flaky spec with deterministic row order
2023-08-11 10:14:47 +10:00
Maikel
146b09dc57
Spec EnterpriseFee tax_category association
...
Co-authored-by: David Cook <david@redcliffs.net >
2023-08-11 10:14:47 +10:00
Maikel Linke
efbf1d6b8f
Stabilise flaky assertion on PDF text
...
The PDF reader can't always place text elements in the right place. So
something that should be in one line can be in multiple lines and those
lines can be in a different order. I'm asserting the moving parts
separately as done in other places of this spec.
2023-08-11 10:14:47 +10:00
Maikel Linke
1b6eeb0928
Reduce line length of PaymentMethod class
...
Rubocop was complaining. So I found code that could be simplified and
specced it before refactoring.
2023-08-11 10:14:47 +10:00
Maikel Linke
e6c679cb34
Apply belongs_to_required_by_default to all models
...
Unless they state otherwise.
The new standard also changes the default behaviour of the Shoulda
matcher in Rspec. It now defaults to asserting that an association is
required. That needed some spec updates.
In one case, Spree::Product, I also had to update the model because the
presence validation was somehow not recognised by the Shoulda matcher.
The error message may change slightly but the outcome should be the
same.
2023-08-11 10:14:47 +10:00
Maikel Linke
4dd2955400
Require EnterpriseRelationshipPermission.belongs_to by default
...
I had to change some specs to keep them simple but I don't think
anything is broken. In one case, it would have needed a lot more setup
to make the spec work. But in production, the permissions are never used
with ModelSet, for example.
2023-08-11 10:13:48 +10:00
Maikel Linke
4b630f187b
Require EnterpriseGroup.belongs_to by default
2023-08-11 10:13:10 +10:00
Maikel Linke
13b2f37884
Require EnterpriseFee.belongs_to by default
2023-08-11 10:13:09 +10:00
Maikel Linke
87ccfc94ef
Require Enterprise.belongs_to by default
...
And remove a duplicate spec.
2023-08-11 10:13:09 +10:00
Konrad
60212f92c3
Merge pull request #11270 from rioug/9553-removing-cutomer-tag-when-search-for-tag
...
Fix removing customer tag when using search bar for said tag
2023-08-11 00:11:55 +02:00
Konrad
c3414143e6
Merge pull request #11222 from Matt-Yorkley/checkout-controller
...
Reduce controller size
2023-08-10 23:28:57 +02:00
Konrad
f59e681826
Merge pull request #11259 from cillian/single-line-voucher-code
...
Don't allow multi-line voucher codes
2023-08-10 23:09:55 +02:00
Jean-Baptiste Bellet
5b4b37032c
Add translation for invalid URL in white label context
2023-08-10 15:22:35 +02:00
Jean-Baptiste Bellet
3b68674896
Remove new_products_page and all associated controller/components/
...
new_products_page` is dead, long live `admin_style_v3` !
2023-08-10 10:02:45 +02:00
jibees
f58fedfc86
Merge pull request #11376 from mkllnk/flaky-voucher-spec
...
Stabilise flaky checkout spec with voucher
2023-08-10 09:10:59 +02:00
David Cook
f64a24a5bb
Respond to all formats with html
2023-08-10 16:14:08 +10:00
David Cook
c191158a97
Use the newer syntax
2023-08-10 14:52:04 +10:00
Maikel
8db8d6de8d
Merge pull request #11372 from Matt-Yorkley/remove-variant-position
...
Remove unused variant :position attribute
2023-08-10 11:48:55 +10:00