-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update gem to support the latest Solidus version
- Loading branch information
1 parent
7699ce0
commit aac1289
Showing
66 changed files
with
880 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,71 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
# Required for feature specs. | ||
browser-tools: circleci/[email protected] | ||
|
||
# Always take the latest version of the orb, this allows us to | ||
# run specs against Solidus supported versions only without the need | ||
# to change this configuration every time a Solidus version is released | ||
# or goes EOL. | ||
solidusio_extensions: solidusio/extensions@volatile | ||
|
||
commands: | ||
test-with-starter-frontend: | ||
steps: | ||
- checkout | ||
- browser-tools/install-chrome | ||
- run: | ||
name: Install libvips | ||
command: | | ||
sudo apt-get update | ||
sudo apt-get install -yq libvips-dev | ||
- solidusio_extensions/test-branch: | ||
branch: main | ||
command: | | ||
export FRONTEND=starter | ||
sudo gem update --system | ||
gem install bundler rails:'~>7.2' | ||
bundle exec rake | ||
- solidusio_extensions/store-test-results | ||
|
||
jobs: | ||
run-specs-with-postgres: | ||
executor: | ||
name: solidusio_extensions/postgres | ||
ruby_version: "3.0" | ||
ruby_version: "3.2" | ||
steps: | ||
- solidusio_extensions/run-tests | ||
- test-with-starter-frontend | ||
|
||
run-specs-with-mysql: | ||
executor: | ||
name: solidusio_extensions/mysql | ||
ruby_version: "3.0" | ||
ruby_version: "3.2" | ||
steps: | ||
- solidusio_extensions/run-tests | ||
- test-with-starter-frontend | ||
|
||
run-specs-with-sqlite: | ||
executor: | ||
name: solidusio_extensions/sqlite | ||
ruby_version: "3.1" | ||
steps: | ||
- test-with-starter-frontend | ||
|
||
lint-code: | ||
executor: | ||
name: solidusio_extensions/sqlite-memory | ||
ruby_version: "3.2" | ||
steps: | ||
- solidusio_extensions/lint-code | ||
|
||
workflows: | ||
"Run specs on supported Solidus versions": | ||
jobs: | ||
- run-specs-with-postgres | ||
- run-specs-with-mysql | ||
- run-specs-with-sqlite | ||
- lint-code | ||
|
||
"Weekly run specs against master": | ||
triggers: | ||
- schedule: | ||
|
@@ -37,3 +77,4 @@ workflows: | |
jobs: | ||
- run-specs-with-postgres | ||
- run-specs-with-mysql | ||
- run-specs-with-sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ pkg | |
*.swp | ||
spec/dummy | ||
spec/examples.txt | ||
/sandbox | ||
/dummy-app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
inherit_from: .rubocop_todo.yml | ||
|
||
require: | ||
- solidus_dev_support/rubocop | ||
|
||
AllCops: | ||
TargetRubyVersion: 3.0 | ||
NewCops: disable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config` | ||
# on 2025-01-22 08:20:44 UTC using RuboCop version 1.70.0. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the offenses are removed from the code base. | ||
# Note that changes in the inspected code, or installation of new | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: Severity, Include. | ||
# Include: **/*.gemspec | ||
Gemspec/RequiredRubyVersion: | ||
Exclude: | ||
- 'solidus_multi_domain.gemspec' | ||
|
||
# Offense count: 1 | ||
# This cop supports safe autocorrection (--autocorrect). | ||
Layout/EmptyLineAfterGuardClause: | ||
Exclude: | ||
- 'app/decorators/controllers/solidus_multi_domain/taxons_controller_decorator.rb' | ||
|
||
# Offense count: 1 | ||
# This cop supports safe autocorrection (--autocorrect). | ||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. | ||
Layout/ExtraSpacing: | ||
Exclude: | ||
- 'lib/generators/solidus_multi_domain/install/templates/sample_data/taxonomies.rb' | ||
|
||
# Offense count: 2 | ||
# Configuration parameters: AllowedMethods. | ||
# AllowedMethods: enums | ||
Lint/ConstantDefinitionInBlock: | ||
Exclude: | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 3 | ||
Naming/AccessorMethodName: | ||
Exclude: | ||
- 'app/decorators/helpers/solidus_multi_domain/spree/products_helper_decorator.rb' | ||
- 'app/models/spree/search/multi_domain.rb' | ||
- 'lib/solidus_multi_domain/multi_domain_helpers.rb' | ||
|
||
# Offense count: 5 | ||
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. | ||
# SupportedStyles: snake_case, normalcase, non_integer | ||
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 | ||
Naming/VariableNumber: | ||
Exclude: | ||
- 'spec/controllers/products_controller_spec.rb' | ||
- 'spec/models/spree/store_spec.rb' | ||
- 'spec/requests/spree/api/products_controller_spec.rb' | ||
|
||
# Offense count: 2 | ||
RSpec/BeforeAfterAll: | ||
Exclude: | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 8 | ||
# Configuration parameters: Prefixes, AllowedPatterns. | ||
# Prefixes: when, with, without | ||
RSpec/ContextWording: | ||
Exclude: | ||
- 'spec/controllers/spree/api/line_items_controller_spec.rb' | ||
- 'spec/controllers/spree/api/shipments_controller_spec.rb' | ||
- 'spec/models/spree/line_item_spec.rb' | ||
- 'spec/models/spree/taxon_decorator_spec.rb' | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 3 | ||
# Configuration parameters: IgnoredMetadata. | ||
RSpec/DescribeClass: | ||
Exclude: | ||
- 'spec/lib/spree_multi_domain/testing_support/factory_overrides_spec.rb' | ||
- 'spec/requests/global_controller_helpers_spec.rb' | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 1 | ||
RSpec/DescribeSymbol: | ||
Exclude: | ||
- 'spec/requests/spree/api/products_controller_spec.rb' | ||
|
||
# Offense count: 15 | ||
# Configuration parameters: AssignmentOnly. | ||
RSpec/InstanceVariable: | ||
Exclude: | ||
- 'spec/controllers/spree/admin/products_controller_spec.rb' | ||
- 'spec/models/spree/product_spec.rb' | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 2 | ||
RSpec/LeakyConstantDeclaration: | ||
Exclude: | ||
- 'spec/requests/template_renderer_spec.rb' | ||
|
||
# Offense count: 4 | ||
RSpec/LetSetup: | ||
Exclude: | ||
- 'spec/controllers/products_controller_spec.rb' | ||
- 'spec/requests/global_controller_helpers_spec.rb' | ||
|
||
# Offense count: 7 | ||
RSpec/MultipleExpectations: | ||
Max: 4 | ||
|
||
# Offense count: 4 | ||
# Configuration parameters: AllowSubject. | ||
RSpec/MultipleMemoizedHelpers: | ||
Max: 6 | ||
|
||
# Offense count: 10 | ||
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. | ||
# SupportedStyles: always, named_only | ||
RSpec/NamedSubject: | ||
Exclude: | ||
- 'spec/controllers/spree/api/line_items_controller_spec.rb' | ||
- 'spec/controllers/spree/api/shipments_controller_spec.rb' | ||
- 'spec/models/spree/line_item_spec.rb' | ||
- 'spec/requests/spree/api/products_controller_spec.rb' | ||
|
||
# Offense count: 4 | ||
# Configuration parameters: AllowedGroups. | ||
RSpec/NestedGroups: | ||
Max: 4 | ||
|
||
# Offense count: 1 | ||
# This cop supports unsafe autocorrection (--autocorrect-all). | ||
# Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers. | ||
# Whitelist: find_by_sql, find_by_token_for | ||
# AllowedMethods: find_by_sql, find_by_token_for | ||
# AllowedReceivers: Gem::Specification, page | ||
Rails/DynamicFindBy: | ||
Exclude: | ||
- 'app/decorators/controllers/solidus_multi_domain/taxons_controller_decorator.rb' | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: Include. | ||
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb | ||
Rails/LexicallyScopedActionFilter: | ||
Exclude: | ||
- 'app/controllers/concerns/solidus_multi_domain/show_product_support.rb' | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: ForbiddenMethods, AllowedMethods. | ||
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all | ||
Rails/SkipsModelValidations: | ||
Exclude: | ||
- 'app/decorators/helpers/solidus_multi_domain/spree/core/controller_helpers/order_decorator.rb' | ||
|
||
# Offense count: 11 | ||
# This cop supports safe autocorrection (--autocorrect). | ||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. | ||
# URISchemes: http, https | ||
Layout/LineLength: | ||
Max: 339 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require 'solidus_dev_support/rake_tasks' | ||
SolidusDevSupport::RakeTasks.install | ||
|
||
task default: 'extension:specs' | ||
task :default do | ||
require 'bundler' | ||
Bundler.with_unbundled_env do | ||
sh 'bin/rspec' | ||
end | ||
end |
23 changes: 13 additions & 10 deletions
23
app/controllers/concerns/solidus_multi_domain/create_line_item_support.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusMultiDomain::CreateLineItemSupport | ||
extend ActiveSupport::Concern | ||
module SolidusMultiDomain | ||
module CreateLineItemSupport | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
prepend(InstanceMethods) | ||
rescue_from SolidusMultiDomain::ProductDoesNotBelongToStoreError, with: :product_does_not_belong_to_store | ||
end | ||
included do | ||
prepend(InstanceMethods) | ||
rescue_from SolidusMultiDomain::ProductDoesNotBelongToStoreError, with: :product_does_not_belong_to_store | ||
end | ||
|
||
module InstanceMethods | ||
private | ||
module InstanceMethods | ||
private | ||
|
||
def product_does_not_belong_to_store | ||
render json: { message: I18n.t('spree.errors.products_from_different_stores_may_not_be_added_to_this_order') }, status: :unprocessable_entity | ||
def product_does_not_belong_to_store | ||
render json: { message: I18n.t('spree.errors.products_from_different_stores_may_not_be_added_to_this_order') }, | ||
status: :unprocessable_entity | ||
end | ||
end | ||
end | ||
end |
22 changes: 12 additions & 10 deletions
22
app/controllers/concerns/solidus_multi_domain/show_product_support.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.