solidus_product_assembly 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +48 -10
- data/.github/stale.yml +4 -4
- data/.github_changelog_generator +2 -0
- data/.gitignore +4 -0
- data/.rspec +0 -1
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +153 -29
- data/CHANGELOG.md +2 -18
- data/Gemfile +28 -8
- data/OLD_CHANGELOG.md +116 -0
- data/README.md +64 -73
- data/Rakefile +1 -0
- data/app/decorators/models/solidus_product_assembly/spree/product_decorator.rb +19 -6
- data/app/decorators/models/solidus_product_assembly/spree/stock/differentiator_decorator.rb +17 -0
- data/app/views/spree/admin/parts/_parts_table.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_assembly_product_tabs.html.erb +3 -3
- data/bin/rails +4 -12
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +102 -0
- data/bin/setup +1 -1
- data/lib/generators/solidus_product_assembly/install/install_generator.rb +15 -9
- data/lib/generators/solidus_product_assembly/install/templates/initializer.rb +6 -0
- data/lib/solidus_product_assembly/configuration.rb +21 -0
- data/lib/solidus_product_assembly/engine.rb +3 -1
- data/lib/solidus_product_assembly/version.rb +1 -1
- data/lib/solidus_product_assembly.rb +1 -3
- data/solidus_product_assembly.gemspec +34 -37
- data/spec/features/admin/orders_spec.rb +0 -1
- data/spec/features/admin/parts_spec.rb +7 -6
- data/spec/features/admin/return_items_spec.rb +18 -9
- data/spec/models/spree/inventory_unit_spec.rb +0 -1
- data/spec/models/spree/line_item_spec.rb +0 -1
- data/spec/models/spree/order_inventory_assembly_spec.rb +6 -3
- data/spec/models/spree/product_spec.rb +18 -0
- data/spec/spec_helper.rb +13 -10
- metadata +41 -65
- data/app/assets/javascripts/spree/frontend/solidus_product_assembly.js +0 -1
- data/app/assets/stylesheets/spree/frontend/solidus_product_assembly.css +0 -3
- data/app/decorators/controllers/solidus_product_assembly/spree/checkout_controller_decorator.rb +0 -13
data/README.md
CHANGED
@@ -1,24 +1,25 @@
|
|
1
|
-
# Product Assembly
|
1
|
+
# Solidus Product Assembly
|
2
2
|
|
3
|
-
[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly.svg?style=
|
3
|
+
[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly)
|
4
|
+
[![codecov](https://codecov.io/gh/solidusio-contrib/solidus_product_assembly/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_product_assembly)
|
4
5
|
|
5
6
|
Create a product which is composed of other products.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
Add
|
10
|
+
Add solidus_product_assembly to your Gemfile:
|
10
11
|
|
11
12
|
```ruby
|
12
|
-
gem 'solidus_product_assembly'
|
13
|
+
gem 'solidus_product_assembly'
|
13
14
|
```
|
14
15
|
|
15
|
-
|
16
|
-
append solidus_product_assembly to your js manifest file:
|
16
|
+
Bundle your dependencies and run the installation generator:
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
```shell
|
19
|
+
bin/rails generate solidus_product_assembly:install
|
20
|
+
```
|
20
21
|
|
21
|
-
##
|
22
|
+
## Usage
|
22
23
|
|
23
24
|
To build a bundle (assembly product) you'd need to first check the "Can be part"
|
24
25
|
flag on each product you want to be part of the bundle. Then create a product
|
@@ -30,85 +31,75 @@ That means you essentially have a product composed of other products. From a
|
|
30
31
|
customer perspective it's like they are paying a single amount for a collection
|
31
32
|
of products.
|
32
33
|
|
33
|
-
##
|
34
|
+
## Development
|
35
|
+
|
36
|
+
### Testing the extension
|
34
37
|
|
35
|
-
|
38
|
+
First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
|
39
|
+
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
|
40
|
+
`bin/rake extension:test_app`.
|
36
41
|
|
37
|
-
|
38
|
-
|
42
|
+
```shell
|
43
|
+
bin/rake
|
44
|
+
```
|
39
45
|
|
40
|
-
|
41
|
-
extension, `upstream` is the main remote and you have write access to it, you
|
42
|
-
can simply run:
|
46
|
+
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
|
43
47
|
|
44
|
-
```
|
45
|
-
|
48
|
+
```shell
|
49
|
+
bundle exec rubocop
|
46
50
|
```
|
47
51
|
|
48
|
-
|
52
|
+
When testing your application's integration with this extension you may use its factories.
|
53
|
+
Simply add this require statement to your `spec/spec_helper.rb`:
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
- push the tag to the upstream remote
|
54
|
-
- release the new version on RubyGems
|
55
|
+
```ruby
|
56
|
+
require 'solidus_product_assembly/testing_support/factories'
|
57
|
+
```
|
55
58
|
|
56
|
-
Or you can
|
59
|
+
Or, if you are using `FactoryBot.definition_file_paths`, you can load Solidus core
|
60
|
+
factories along with this extension's factories using this statement:
|
57
61
|
|
58
|
-
```
|
59
|
-
|
60
|
-
gem tag
|
61
|
-
gem release
|
62
|
+
```ruby
|
63
|
+
SolidusDevSupport::TestingSupport::Factories.load_for(SolidusProductAssembly::Engine)
|
62
64
|
```
|
63
65
|
|
64
|
-
|
66
|
+
### Running the sandbox
|
67
|
+
|
68
|
+
To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
|
69
|
+
the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
|
70
|
+
`sandbox/bin/rails`.
|
71
|
+
|
72
|
+
Here's an example:
|
65
73
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
74
|
+
```
|
75
|
+
$ bin/rails server
|
76
|
+
=> Booting Puma
|
77
|
+
=> Rails 6.0.2.1 application starting in development
|
78
|
+
* Listening on tcp://127.0.0.1:3000
|
79
|
+
Use Ctrl-C to stop
|
80
|
+
```
|
70
81
|
|
82
|
+
### Updating the changelog
|
71
83
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
84
|
+
Before and after releases the changelog should be updated to reflect the up-to-date status of
|
85
|
+
the project:
|
86
|
+
|
87
|
+
```shell
|
88
|
+
bin/rake changelog
|
89
|
+
git add CHANGELOG.md
|
90
|
+
git commit -m "Update the changelog"
|
76
91
|
```
|
77
92
|
|
93
|
+
### Releasing new versions
|
94
|
+
|
95
|
+
Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.
|
96
|
+
|
78
97
|
## Contributing
|
79
98
|
|
80
|
-
Spree is an open source project and we encourage contributions. Please see the [Community Guidelines]
|
81
|
-
|
82
|
-
In the spirit of [free software]
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
* by reporting [bugs][3]
|
88
|
-
* by suggesting new features
|
89
|
-
* by writing translations
|
90
|
-
* by writing or editing documentation
|
91
|
-
* by writing specifications
|
92
|
-
* by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
|
93
|
-
* by refactoring code
|
94
|
-
* by resolving [issues][3]
|
95
|
-
* by reviewing patches
|
96
|
-
|
97
|
-
Starting point:
|
98
|
-
|
99
|
-
* Fork the repo
|
100
|
-
* Clone your repo
|
101
|
-
* Run `bundle install`
|
102
|
-
* Run `bundle exec rake test_app` to create the test application in `spec/test_app`
|
103
|
-
* Make your changes
|
104
|
-
* Ensure specs pass by running `bundle exec rspec spec`
|
105
|
-
* Submit your pull request
|
106
|
-
|
107
|
-
Copyright (c) 2014 [Spree Commerce Inc.][4] and [contributors][5], released under the [New BSD License][6]
|
108
|
-
|
109
|
-
[1]: https://solidus.io/community-guidelines/
|
110
|
-
[2]: http://www.fsf.org/licensing/essays/free-sw.html
|
111
|
-
[3]: https://github.com/spree/spree-product-assembly/issues
|
112
|
-
[4]: https://github.com/spree
|
113
|
-
[5]: https://github.com/spree/spree-product-assembly/graphs/contributors
|
114
|
-
[6]: https://github.com/spree/spree-product-assembly/blob/master/LICENSE.md
|
99
|
+
Spree is an open source project and we encourage contributions. Please see the [Community Guidelines](https://solidus.io/community-guidelines/) before contributing.
|
100
|
+
|
101
|
+
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
102
|
+
|
103
|
+
## License
|
104
|
+
|
105
|
+
Copyright (c) 2014 [Spree Commerce Inc.](https://github.com/spree) and [contributors](https://github.com/spree/spree-product-assembly/graphs/contributors), released under the [New BSD License](LICENSE)
|
data/Rakefile
CHANGED
@@ -14,12 +14,25 @@ module SolidusProductAssembly
|
|
14
14
|
|
15
15
|
scope :individual_saled, -> { where(individual_sale: true) }
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
if defined?(SolidusGlobalize)
|
18
|
+
scope :search_can_be_part, ->(query){
|
19
|
+
not_deleted.available.joins(:master)
|
20
|
+
.joins(:translations)
|
21
|
+
.where(
|
22
|
+
::Spree::Product::Translation.arel_table["name"].matches(query)
|
23
|
+
.or(::Spree::Variant.arel_table["sku"].matches(query))
|
24
|
+
)
|
25
|
+
.where(can_be_part: true)
|
26
|
+
.limit(30)
|
27
|
+
}
|
28
|
+
else
|
29
|
+
scope :search_can_be_part, ->(query){
|
30
|
+
not_deleted.available.joins(:master)
|
31
|
+
.where(arel_table["name"].matches(query).or(::Spree::Variant.arel_table["sku"].matches(query)))
|
32
|
+
.where(can_be_part: true)
|
33
|
+
.limit(30)
|
34
|
+
}
|
35
|
+
end
|
23
36
|
|
24
37
|
validate :assembly_cannot_be_part, if: :assembly?
|
25
38
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusProductAssembly
|
4
|
+
module Spree
|
5
|
+
module Stock
|
6
|
+
module DifferentiatorDecorator
|
7
|
+
def build_missing
|
8
|
+
super.tap do
|
9
|
+
@missing.delete_if { |k, _v| k.product.assembly? }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
::Spree::Stock::Differentiator.prepend self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
:class => "set_count_admin_product_part_link save-line-item") %>
|
25
25
|
|
26
26
|
<%= link_to_with_icon(
|
27
|
-
'
|
27
|
+
'trash',
|
28
28
|
t('spree.actions.delete'),
|
29
29
|
remove_admin_product_part_url(@product, part),
|
30
30
|
class: "remove_admin_product_part_link delete-line-item") %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
1
|
+
<%= content_tag :li, class: ('active' if current == 'Parts') do %>
|
2
|
+
<%= link_to t('spree.parts'), admin_product_parts_url(@product) %>
|
3
|
+
<% end if can?(:admin, Spree::AssembliesPart) && !@product.deleted? %>
|
data/bin/rails
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
unless File.exist? "#{app_root}/bin/rails"
|
8
|
-
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
|
9
|
-
warn "Automatic creation of the dummy app failed"
|
10
|
-
exit 1
|
11
|
-
end
|
3
|
+
if %w[g generate].include? ARGV.first
|
4
|
+
exec "#{__dir__}/rails-engine", *ARGV
|
5
|
+
else
|
6
|
+
exec "#{__dir__}/rails-sandbox", *ARGV
|
12
7
|
end
|
13
|
-
|
14
|
-
Dir.chdir app_root
|
15
|
-
exec 'bin/rails', *ARGV
|
data/bin/rails-engine
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
6
|
+
ENGINE_PATH = File.expand_path('../lib/solidus_product_assembly/engine', __dir__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'rails/all'
|
13
|
+
require 'rails/engine/commands'
|
data/bin/rails-sandbox
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
app_root = 'sandbox'
|
4
|
+
|
5
|
+
unless File.exist? "#{app_root}/bin/rails"
|
6
|
+
warn 'Creating the sandbox app...'
|
7
|
+
Dir.chdir "#{__dir__}/.." do
|
8
|
+
system "#{__dir__}/sandbox" or begin
|
9
|
+
warn 'Automatic creation of the sandbox app failed'
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Dir.chdir app_root
|
16
|
+
exec 'bin/rails', *ARGV
|
data/bin/rake
ADDED
data/bin/sandbox
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
if [ ! -z $DEBUG ]
|
5
|
+
then
|
6
|
+
set -x
|
7
|
+
fi
|
8
|
+
|
9
|
+
case "$DB" in
|
10
|
+
postgres|postgresql)
|
11
|
+
RAILSDB="postgresql"
|
12
|
+
;;
|
13
|
+
mysql)
|
14
|
+
RAILSDB="mysql"
|
15
|
+
;;
|
16
|
+
sqlite3|sqlite)
|
17
|
+
RAILSDB="sqlite3"
|
18
|
+
;;
|
19
|
+
'')
|
20
|
+
echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
|
21
|
+
RAILSDB="sqlite3"
|
22
|
+
;;
|
23
|
+
*)
|
24
|
+
echo "Invalid value specified for the Solidus sandbox: DB=\"$DB\"."
|
25
|
+
echo "Please use 'postgres', 'mysql', or 'sqlite' instead."
|
26
|
+
exit 1
|
27
|
+
;;
|
28
|
+
esac
|
29
|
+
echo "~~> Using $RAILSDB as the database engine"
|
30
|
+
|
31
|
+
if [ -n $SOLIDUS_BRANCH ]
|
32
|
+
then
|
33
|
+
BRANCH=$SOLIDUS_BRANCH
|
34
|
+
else
|
35
|
+
echo "~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch"
|
36
|
+
BRANCH="master"
|
37
|
+
fi
|
38
|
+
echo "~~> Using branch $BRANCH of solidus"
|
39
|
+
|
40
|
+
if [ -z $SOLIDUS_FRONTEND ]
|
41
|
+
then
|
42
|
+
echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
|
43
|
+
SOLIDUS_FRONTEND="solidus_frontend"
|
44
|
+
fi
|
45
|
+
echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"
|
46
|
+
|
47
|
+
extension_name="solidus_product_assembly"
|
48
|
+
|
49
|
+
# Stay away from the bundler env of the containing extension.
|
50
|
+
function unbundled {
|
51
|
+
ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
|
52
|
+
}
|
53
|
+
|
54
|
+
rm -rf ./sandbox
|
55
|
+
unbundled bundle exec rails new sandbox --database="$RAILSDB" \
|
56
|
+
--skip-bundle \
|
57
|
+
--skip-git \
|
58
|
+
--skip-keeps \
|
59
|
+
--skip-rc \
|
60
|
+
--skip-spring \
|
61
|
+
--skip-test \
|
62
|
+
--skip-javascript
|
63
|
+
|
64
|
+
if [ ! -d "sandbox" ]; then
|
65
|
+
echo 'sandbox rails application failed'
|
66
|
+
exit 1
|
67
|
+
fi
|
68
|
+
|
69
|
+
cd ./sandbox
|
70
|
+
cat <<RUBY >> Gemfile
|
71
|
+
gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
|
72
|
+
gem 'rails-i18n'
|
73
|
+
gem 'solidus_i18n'
|
74
|
+
|
75
|
+
gem '$extension_name', path: '..'
|
76
|
+
|
77
|
+
group :test, :development do
|
78
|
+
platforms :mri do
|
79
|
+
gem 'pry-byebug'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
RUBY
|
83
|
+
|
84
|
+
unbundled bundle install --gemfile Gemfile
|
85
|
+
|
86
|
+
unbundled bundle exec rake db:drop db:create
|
87
|
+
|
88
|
+
unbundled bundle exec rails generate solidus:install \
|
89
|
+
--auto-accept \
|
90
|
+
--user_class=Spree::User \
|
91
|
+
--enforce_available_locales=true \
|
92
|
+
--with-authentication=true \
|
93
|
+
--payment-method=none \
|
94
|
+
--frontend=${SOLIDUS_FRONTEND} \
|
95
|
+
$@
|
96
|
+
|
97
|
+
unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
|
98
|
+
unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations
|
99
|
+
|
100
|
+
echo
|
101
|
+
echo "🚀 Sandbox app successfully created for $extension_name!"
|
102
|
+
echo "🧪 This app is intended for test purposes."
|
data/bin/setup
CHANGED
@@ -4,24 +4,30 @@ module SolidusProductAssembly
|
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
6
|
class_option :auto_run_migrations, type: :boolean, default: false
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
7
8
|
|
8
|
-
def
|
9
|
-
|
9
|
+
def copy_initializer
|
10
|
+
template 'initializer.rb', 'config/initializers/solidus_product_assembly.rb'
|
10
11
|
end
|
11
12
|
|
12
13
|
def add_javascripts
|
13
|
-
append_file
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_product_assembly\n"
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_stylesheets
|
18
|
+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_product_assembly\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_migrations
|
22
|
+
run 'bin/rails railties:install:migrations FROM=solidus_product_assembly'
|
17
23
|
end
|
18
24
|
|
19
25
|
def run_migrations
|
20
|
-
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
26
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
|
21
27
|
if run_migrations
|
22
|
-
run '
|
28
|
+
run 'bin/rails db:migrate'
|
23
29
|
else
|
24
|
-
puts 'Skipping
|
30
|
+
puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusProductAssembly
|
4
|
+
class Configuration
|
5
|
+
# Define here the settings for this extension, e.g.:
|
6
|
+
#
|
7
|
+
# attr_accessor :my_setting
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
alias config configuration
|
16
|
+
|
17
|
+
def configure
|
18
|
+
yield configuration
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,40 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
s.add_development_dependency 'github_changelog_generator'
|
38
|
-
s.add_development_dependency 'selenium-webdriver'
|
39
|
-
s.add_development_dependency 'solidus_dev_support'
|
3
|
+
require_relative 'lib/solidus_product_assembly/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'solidus_product_assembly'
|
7
|
+
spec.version = SolidusProductAssembly::VERSION
|
8
|
+
spec.authors = ['Roman Smirnov']
|
9
|
+
spec.email = 'roman@railsdog.com'
|
10
|
+
|
11
|
+
spec.summary = 'Make bundle of products to your Solidus store'
|
12
|
+
spec.description = 'Make bundle of products to your Solidus store'
|
13
|
+
spec.homepage = 'https://github.com/solidusio-contrib/solidus_product_assembly'
|
14
|
+
spec.license = 'BSD-3-Clause'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_product_assembly'
|
18
|
+
spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_product_assembly/releases'
|
19
|
+
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5', '< 4')
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
25
|
+
|
26
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
27
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency 'solidus_core', '>= 3.2'
|
33
|
+
spec.add_dependency 'solidus_support', '~> 0.8'
|
34
|
+
spec.add_dependency 'deface'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
|
40
37
|
end
|
@@ -14,17 +14,18 @@ describe "Parts", type: :feature, js: true do
|
|
14
14
|
click_on "Update"
|
15
15
|
end
|
16
16
|
|
17
|
-
it "add and remove parts" do
|
17
|
+
it "can add and remove parts" do
|
18
18
|
visit spree.admin_product_path(tshirt)
|
19
19
|
click_on "Parts"
|
20
20
|
fill_in "searchtext", with: mug.name
|
21
21
|
click_on "Search"
|
22
|
+
click_on "Select"
|
23
|
+
expect(page).to have_link('Delete')
|
22
24
|
|
23
|
-
|
24
|
-
expect(page).to have_content(mug.sku)
|
25
|
+
expect(tshirt.reload.parts).to eq([mug.master])
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
click_on 'Delete', wait: 30
|
28
|
+
expect(page).not_to have_link('Delete')
|
29
|
+
expect(tshirt.reload.parts).to eq([])
|
29
30
|
end
|
30
31
|
end
|