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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +48 -10
  3. data/.github/stale.yml +4 -4
  4. data/.github_changelog_generator +2 -0
  5. data/.gitignore +4 -0
  6. data/.rspec +0 -1
  7. data/.rubocop.yml +4 -1
  8. data/.rubocop_todo.yml +153 -29
  9. data/CHANGELOG.md +2 -18
  10. data/Gemfile +28 -8
  11. data/OLD_CHANGELOG.md +116 -0
  12. data/README.md +64 -73
  13. data/Rakefile +1 -0
  14. data/app/decorators/models/solidus_product_assembly/spree/product_decorator.rb +19 -6
  15. data/app/decorators/models/solidus_product_assembly/spree/stock/differentiator_decorator.rb +17 -0
  16. data/app/views/spree/admin/parts/_parts_table.html.erb +1 -1
  17. data/app/views/spree/admin/shared/_product_assembly_product_tabs.html.erb +3 -3
  18. data/bin/rails +4 -12
  19. data/bin/rails-engine +13 -0
  20. data/bin/rails-sandbox +16 -0
  21. data/bin/rake +7 -0
  22. data/bin/sandbox +102 -0
  23. data/bin/setup +1 -1
  24. data/lib/generators/solidus_product_assembly/install/install_generator.rb +15 -9
  25. data/lib/generators/solidus_product_assembly/install/templates/initializer.rb +6 -0
  26. data/lib/solidus_product_assembly/configuration.rb +21 -0
  27. data/lib/solidus_product_assembly/engine.rb +3 -1
  28. data/lib/solidus_product_assembly/version.rb +1 -1
  29. data/lib/solidus_product_assembly.rb +1 -3
  30. data/solidus_product_assembly.gemspec +34 -37
  31. data/spec/features/admin/orders_spec.rb +0 -1
  32. data/spec/features/admin/parts_spec.rb +7 -6
  33. data/spec/features/admin/return_items_spec.rb +18 -9
  34. data/spec/models/spree/inventory_unit_spec.rb +0 -1
  35. data/spec/models/spree/line_item_spec.rb +0 -1
  36. data/spec/models/spree/order_inventory_assembly_spec.rb +6 -3
  37. data/spec/models/spree/product_spec.rb +18 -0
  38. data/spec/spec_helper.rb +13 -10
  39. metadata +41 -65
  40. data/app/assets/javascripts/spree/frontend/solidus_product_assembly.js +0 -1
  41. data/app/assets/stylesheets/spree/frontend/solidus_product_assembly.css +0 -3
  42. 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=svg)](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly)
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 the following line to your `Gemfile`:
10
+ Add solidus_product_assembly to your Gemfile:
10
11
 
11
12
  ```ruby
12
- gem 'solidus_product_assembly', github: 'solidusio-contrib/solidus_product_assembly', branch: 'master'
13
+ gem 'solidus_product_assembly'
13
14
  ```
14
15
 
15
- Run bundle install as well as the extension intall command to copy and run migrations and
16
- append solidus_product_assembly to your js manifest file:
16
+ Bundle your dependencies and run the installation generator:
17
17
 
18
- bundle install
19
- rails g solidus_product_assembly:install
18
+ ```shell
19
+ bin/rails generate solidus_product_assembly:install
20
+ ```
20
21
 
21
- ## Use
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
- ## Releasing a new version
34
+ ## Development
35
+
36
+ ### Testing the extension
34
37
 
35
- #### 1. Bump gem version and push to RubyGems
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
- We use [gem-release](https://github.com/svenfuchs/gem-release) to release this
38
- extension with ease.
42
+ ```shell
43
+ bin/rake
44
+ ```
39
45
 
40
- Supposing you are on the master branch and you are working on a fork of this
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
- ```bash
45
- gem bump --version minor --tag --release
48
+ ```shell
49
+ bundle exec rubocop
46
50
  ```
47
51
 
48
- This command will:
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
- - bump the gem version to the next minor (changing the `version.rb` file)
51
- - commit the change and push it to upstream master
52
- - create a git tag
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 run these commands individually:
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
- ```bash
59
- gem bump --version minor
60
- gem tag
61
- gem release
62
+ ```ruby
63
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusProductAssembly::Engine)
62
64
  ```
63
65
 
64
- #### 2. Publish the updated CHANGELOG
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
- After the release is done we can generate the updated CHANGELOG
67
- using
68
- [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator)
69
- by running the following command:
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
- ```bash
73
- bundle exec github_changelog_generator solidusio/solidus_auth_devise --token YOUR_GITHUB_TOKEN
74
- git commit -am 'Update CHANGELOG'
75
- git push upstream master
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][1] before contributing.
81
-
82
- In the spirit of [free software][2], **everyone** is encouraged to help improve this project.
83
-
84
- Here are some ways *you* can contribute:
85
-
86
- * by using prerelease versions
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
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bundler/gem_tasks'
3
4
  require 'solidus_dev_support/rake_tasks'
4
5
  SolidusDevSupport::RakeTasks.install
5
6
 
@@ -14,12 +14,25 @@ module SolidusProductAssembly
14
14
 
15
15
  scope :individual_saled, -> { where(individual_sale: true) }
16
16
 
17
- scope :search_can_be_part, ->(query){
18
- not_deleted.available.joins(:master)
19
- .where(arel_table["name"].matches("%#{query}%").or(::Spree::Variant.arel_table["sku"].matches("%#{query}%")))
20
- .where(can_be_part: true)
21
- .limit(30)
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
- 'delete',
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
- <li<%= ' class="active"' if current == "Parts" %>>
2
- <%= link_to_with_icon 'sitemap', t('spree.parts'), admin_product_parts_url(@product) %>
3
- </li>
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
- # frozen_string_literal: true
4
-
5
- app_root = 'spec/dummy'
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
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
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
@@ -5,4 +5,4 @@ set -vx
5
5
 
6
6
  gem install bundler --conservative
7
7
  bundle update
8
- bundle exec rake clobber
8
+ bin/rake clobber
@@ -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 add_migrations
9
- run 'bundle exec rake railties:install:migrations FROM=solidus_product_assembly'
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
- 'vendor/assets/javascripts/spree/backend/all.js',
15
- "//= require spree/backend/solidus_product_assembly\n"
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 'bundle exec rake db:migrate'
28
+ run 'bin/rails db:migrate'
23
29
  else
24
- puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
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,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ SolidusProductAssembly.configure do |config|
4
+ # TODO: Remember to change this with the actual preferences you have implemented!
5
+ # config.sample_preference = 'sample_value'
6
+ 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,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core'
3
+ require 'solidus_core'
4
+ require 'solidus_support'
5
+ require 'deface'
4
6
 
5
7
  module SolidusProductAssembly
6
8
  class Engine < Rails::Engine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusProductAssembly
4
- VERSION = '1.1.0'
4
+ VERSION = '1.3.0'
5
5
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'solidus_core'
4
- require 'solidus_support'
3
+ require 'solidus_product_assembly/configuration'
5
4
  require 'solidus_product_assembly/version'
6
5
  require 'solidus_product_assembly/engine'
7
- require 'deface'
@@ -1,40 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $:.push File.expand_path('lib', __dir__)
4
- require 'solidus_product_assembly/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.platform = Gem::Platform::RUBY
8
- s.name = 'solidus_product_assembly'
9
- s.version = SolidusProductAssembly::VERSION
10
- s.summary = 'Adds oportunity to make bundle of products to your Spree store'
11
- s.description = s.summary
12
- s.license = 'BSD-3-Clause'
13
-
14
- s.required_ruby_version = '>= 2.4'
15
-
16
- s.author = 'Roman Smirnov'
17
- s.email = 'roman@railsdog.com'
18
- s.homepage = 'https://solidus.io'
19
-
20
- s.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
- end
23
- s.test_files = Dir['spec/**/*']
24
- s.bindir = "exe"
25
- s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- s.require_paths = ["lib"]
27
-
28
- if s.respond_to?(:metadata)
29
- s.metadata["homepage_uri"] = s.homepage if s.homepage
30
- s.metadata["source_code_uri"] = "https://github.com/solidusio-contrib/solidus_product_assembly"
31
- end
32
-
33
- s.add_dependency 'deface'
34
- s.add_dependency 'solidus_core', ['>= 1.0', '< 4']
35
- s.add_dependency 'solidus_support', '~> 0.8'
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
@@ -15,7 +15,6 @@ describe "Orders", type: :feature, js: true do
15
15
  bundle.parts << [parts]
16
16
  line_item.update!(quantity: 3)
17
17
  order.reload.create_proposed_shipments
18
- order.finalize!
19
18
  end
20
19
 
21
20
  if Spree.solidus_gem_version < Gem::Version.new('2.5')
@@ -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
- within("#search_hits") { click_on "Select" }
24
- expect(page).to have_content(mug.sku)
25
+ expect(tshirt.reload.parts).to eq([mug.master])
25
26
 
26
- within("#product_parts") do
27
- find(".remove_admin_product_part_link").click
28
- end
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