solidus_related_products 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 796ec99b0714a1e62195cac718d7ee685e444885
4
- data.tar.gz: 383f4d8974811a381e1ab46ca51078bdd4bb00d2
3
+ metadata.gz: 752931ed32a44beaa71d0065db52b172dca391c0
4
+ data.tar.gz: fb64275f2eca94076f2abb24c24e33a69204ff3d
5
5
  SHA512:
6
- metadata.gz: df78c358ae876c2d31319614c7122020379ccdd6b7c1720646874b69b15c2164afe2fd03c22671093f6af4d236e0725b98cb0bbbfcf9932c71749741d2e0df75
7
- data.tar.gz: 335f7498dbe1557d39fed0f93dadb058fbfce3bec0e66ef213b8d2953b479e3bf28d7d28c90a769bc66a60bd8111f317bffd58301a96951948b4b3cb8e77866c
6
+ metadata.gz: dbb92a4271f86e0d5202375a244510f177bb9d478b566449856da8d50166282abe28a3edc2e28d9dcfb1c67336c7e75aa14c203a6071a57b4d65e6c3aae59d92
7
+ data.tar.gz: cf0926217e19ebbf9469b772afdf0cbb71a096c02b3882d9bd83dfb009ac972eee710a8a91af93a94a4aa29f7e86e601be68ec0aa852eedacf0c3130e5ba4864
data/.hound.yml CHANGED
@@ -1,25 +1,8 @@
1
- ---
2
- # Too picky.
3
- LineLength:
4
- Enabled: false
5
-
6
- # This should truly be on for well documented gems.
7
- Documentation:
8
- Enabled: false
9
-
10
- # Neatly aligned code is too swell.
11
- SpaceBeforeFirstArg:
12
- Enabled: false
13
-
14
- # Don't mess with RSpec DSL.
15
- Blocks:
16
- Exclude:
17
- - 'spec/**/*'
18
-
19
- # It say we should use fail over raise.
20
- SignalException:
21
- Enabled: false
22
-
23
- # Avoid contradictory style rules by enforce single quotes.
24
- StringLiterals:
25
- EnforcedStyle: single_quotes
1
+ ruby:
2
+ config_file: .rubocop.yml
3
+ scss:
4
+ enabled: false
5
+ coffeescript:
6
+ enabled: false
7
+ javascript:
8
+ enabled: false
@@ -1,8 +1,227 @@
1
- ---
2
- inherit_from: .hound.yml
1
+ # Relaxed.Ruby.Style
3
2
 
4
3
  AllCops:
5
4
  Exclude:
6
5
  - spec/dummy/**/*
7
- - bin/*
8
- - Guardfile
6
+ - vendor/bundle/*
7
+ TargetRubyVersion: 2.1
8
+
9
+ # Sometimes I believe this reads better
10
+ # This also causes spacing issues on multi-line fixes
11
+ Style/BracesAroundHashParameters:
12
+ Enabled: false
13
+
14
+ # We use class vars and will have to continue doing so for compatability
15
+ Style/ClassVars:
16
+ Enabled: false
17
+
18
+ # We need these names for backwards compatability
19
+ Style/PredicateName:
20
+ Enabled: false
21
+
22
+ Style/AccessorMethodName:
23
+ Enabled: false
24
+
25
+ # This has been used for customization
26
+ Style/MutableConstant:
27
+ Enabled: false
28
+
29
+ Style/ClassAndModuleChildren:
30
+ Enabled: false
31
+
32
+ Style/GuardClause:
33
+ Enabled: false
34
+
35
+ Style/WordArray:
36
+ Enabled: false
37
+
38
+ Style/ConditionalAssignment:
39
+ Enabled: false
40
+
41
+ Performance/Count:
42
+ Enabled: false
43
+
44
+ Style/RaiseArgs:
45
+ Enabled: false
46
+
47
+ Style/OpMethod:
48
+ Enabled: false
49
+
50
+ # We can use good judgement here
51
+ Style/RegexpLiteral:
52
+ Enabled: false
53
+
54
+ # Unicode comments are useful
55
+ Style/AsciiComments:
56
+ Enabled: false
57
+
58
+ Lint/EndAlignment:
59
+ Enabled: false
60
+
61
+ Style/ElseAlignment:
62
+ Enabled: false
63
+
64
+ Style/IndentationWidth:
65
+ Enabled: false
66
+
67
+ Style/AlignParameters:
68
+ Enabled: false
69
+
70
+ Style/ClosingParenthesisIndentation:
71
+ Enabled: false
72
+
73
+ Style/MultilineMethodCallIndentation:
74
+ Enabled: false
75
+
76
+ Style/IndentArray:
77
+ Enabled: false
78
+
79
+ Style/IndentHash:
80
+ Enabled: false
81
+
82
+ Style/AlignHash:
83
+ Enabled: false
84
+
85
+ # From http://relaxed.ruby.style/
86
+
87
+ Style/Alias:
88
+ Enabled: false
89
+ StyleGuide: http://relaxed.ruby.style/#stylealias
90
+
91
+ Style/BeginBlock:
92
+ Enabled: false
93
+ StyleGuide: http://relaxed.ruby.style/#stylebeginblock
94
+
95
+ Style/BlockDelimiters:
96
+ Enabled: false
97
+ StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
98
+
99
+ Style/Documentation:
100
+ Enabled: false
101
+ StyleGuide: http://relaxed.ruby.style/#styledocumentation
102
+
103
+ Style/DotPosition:
104
+ Enabled: false
105
+ StyleGuide: http://relaxed.ruby.style/#styledotposition
106
+
107
+ Style/DoubleNegation:
108
+ Enabled: false
109
+ StyleGuide: http://relaxed.ruby.style/#styledoublenegation
110
+
111
+ Style/EndBlock:
112
+ Enabled: false
113
+ StyleGuide: http://relaxed.ruby.style/#styleendblock
114
+
115
+ Style/FormatString:
116
+ Enabled: false
117
+ StyleGuide: http://relaxed.ruby.style/#styleformatstring
118
+
119
+ Style/IfUnlessModifier:
120
+ Enabled: false
121
+ StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
122
+
123
+ Style/Lambda:
124
+ Enabled: false
125
+ StyleGuide: http://relaxed.ruby.style/#stylelambda
126
+
127
+ Style/ModuleFunction:
128
+ Enabled: false
129
+ StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
130
+
131
+ Style/MultilineBlockChain:
132
+ Enabled: false
133
+ StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
134
+
135
+ Style/NegatedIf:
136
+ Enabled: false
137
+ StyleGuide: http://relaxed.ruby.style/#stylenegatedif
138
+
139
+ Style/NegatedWhile:
140
+ Enabled: false
141
+ StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
142
+
143
+ Style/ParallelAssignment:
144
+ Enabled: false
145
+ StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
146
+
147
+ Style/PercentLiteralDelimiters:
148
+ Enabled: false
149
+ StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
150
+
151
+ Style/PerlBackrefs:
152
+ Enabled: false
153
+ StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
154
+
155
+ Style/Semicolon:
156
+ Enabled: false
157
+ StyleGuide: http://relaxed.ruby.style/#stylesemicolon
158
+
159
+ Style/SignalException:
160
+ Enabled: false
161
+ StyleGuide: http://relaxed.ruby.style/#stylesignalexception
162
+
163
+ Style/SingleLineBlockParams:
164
+ Enabled: false
165
+ StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
166
+
167
+ Style/SingleLineMethods:
168
+ Enabled: false
169
+ StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
170
+
171
+ Style/SpaceBeforeBlockBraces:
172
+ Enabled: false
173
+ StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
174
+
175
+ Style/SpaceInsideParens:
176
+ Enabled: false
177
+ StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
178
+
179
+ Style/SpecialGlobalVars:
180
+ Enabled: false
181
+ StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
182
+
183
+ Style/StringLiterals:
184
+ Enabled: false
185
+ StyleGuide: http://relaxed.ruby.style/#stylestringliterals
186
+
187
+ Style/SymbolProc:
188
+ Enabled: false
189
+
190
+ Style/WhileUntilModifier:
191
+ Enabled: false
192
+ StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
193
+
194
+ Lint/AmbiguousRegexpLiteral:
195
+ Enabled: false
196
+ StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
197
+
198
+ Lint/AssignmentInCondition:
199
+ Enabled: false
200
+ StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
201
+
202
+ Metrics/AbcSize:
203
+ Enabled: false
204
+
205
+ Metrics/BlockNesting:
206
+ Enabled: false
207
+
208
+ Metrics/ClassLength:
209
+ Enabled: false
210
+
211
+ Metrics/ModuleLength:
212
+ Enabled: false
213
+
214
+ Metrics/CyclomaticComplexity:
215
+ Enabled: false
216
+
217
+ Metrics/LineLength:
218
+ Enabled: false
219
+
220
+ Metrics/MethodLength:
221
+ Enabled: false
222
+
223
+ Metrics/ParameterLists:
224
+ Enabled: false
225
+
226
+ Metrics/PerceivedComplexity:
227
+ Enabled: false
@@ -1,15 +1,19 @@
1
- language: ruby
2
- rvm:
3
- - 2.1
4
- - 2.2
5
1
  sudo: false
6
2
  cache: bundler
3
+ language: ruby
4
+ rvm:
5
+ - 2.3.1
7
6
  env:
8
7
  matrix:
9
- - SOLIDUS_BRANCH=master
10
- - SOLIDUS_BRANCH=v1.2
11
- - SOLIDUS_BRANCH=v1.1
12
- before_script:
13
- - bundle exec rake test_app
14
- script:
15
- - bundle exec rspec spec
8
+ - SOLIDUS_BRANCH=v1.1 DB=postgres
9
+ - SOLIDUS_BRANCH=v1.2 DB=postgres
10
+ - SOLIDUS_BRANCH=v1.3 DB=postgres
11
+ - SOLIDUS_BRANCH=v1.4 DB=postgres
12
+ - SOLIDUS_BRANCH=v2.0 DB=postgres
13
+ - SOLIDUS_BRANCH=master DB=postgres
14
+ - SOLIDUS_BRANCH=v1.1 DB=mysql
15
+ - SOLIDUS_BRANCH=v1.2 DB=mysql
16
+ - SOLIDUS_BRANCH=v1.3 DB=mysql
17
+ - SOLIDUS_BRANCH=v1.4 DB=mysql
18
+ - SOLIDUS_BRANCH=v2.0 DB=mysql
19
+ - SOLIDUS_BRANCH=master DB=mysql
@@ -1,6 +1,6 @@
1
1
  # Contributing
2
2
 
3
- Spree Related Products is an open source project and we encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) for more information before contributing.
3
+ Solidus Related Products is an open source project and we encourage contributions.
4
4
 
5
5
  In the spirit of [free software][1], **everyone** is encouraged to help improve this project.
6
6
 
@@ -30,7 +30,7 @@ In the issue itself please provide:
30
30
 
31
31
  * A comprehensive list of steps to reproduce the issue.
32
32
  * What you're *expecting* to happen compared with what's *actually* happening.
33
- * The version of Spree *and* the version of Rails.
33
+ * The version of Solidus *and* the version of Rails.
34
34
  * A list of all extensions.
35
35
  * Any relevant stack traces ("Full trace" preferred)
36
36
  * Your `Gemfile`
@@ -77,5 +77,5 @@ Some things that will increase the chance that your pull request is accepted, ta
77
77
  And in case we didn't emphasize it enough: **we love tests!**
78
78
 
79
79
  [1]: http://www.fsf.org/licensing/essays/free-sw.html
80
- [2]: https://github.com/spree-contrib/spree_related_products/issues
81
- [3]: https://github.com/spree-contrib/spree_related_products/tree/master/config/locales
80
+ [2]: https://github.com/solidusio-contrib/solidus_related_products/issues
81
+ [3]: https://github.com/solidusio-contrib/solidus_related_products/tree/master/config/locales
data/Gemfile CHANGED
@@ -1,6 +1,17 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
4
- gem 'solidus', github: 'solidusio/solidus', branch: branch
4
+ gem "solidus", github: "solidusio/solidus", branch: branch
5
+
6
+ if branch == 'master' || branch >= "v2.0"
7
+ gem "rails-controller-testing", group: :test
8
+ end
9
+
10
+ gem 'pg'
11
+ gem 'mysql2'
12
+
13
+ group :development, :test do
14
+ gem "pry-rails"
15
+ end
5
16
 
6
17
  gemspec
data/README.md CHANGED
@@ -12,7 +12,7 @@ You can manage RelationTypes via the admin configuration menu, and you can maint
12
12
 
13
13
  Add to `Gemfile`:
14
14
  ```ruby
15
- gem 'spree_related_products'
15
+ gem 'solidus_related_products'
16
16
  ```
17
17
 
18
18
  Run:
@@ -73,8 +73,8 @@ See corresponding [guidelines][4]
73
73
  Copyright (c) 2010-2015 [Brian Quinn][5] and [contributors][6], released under the [New BSD License][3]
74
74
 
75
75
  [1]: http://www.fsf.org/licensing/essays/free-sw.html
76
- [2]: https://github.com/spree-contrib/spree_related_products/issues
77
- [3]: https://github.com/spree-contrib/spree_related_products/blob/master/LICENSE.md
78
- [4]: https://github.com/spree-contrib/spree_related_products/blob/master/CONTRIBUTING.md
76
+ [2]: https://github.com/solidusio-contrib/solidus_related_products/issues
77
+ [3]: https://github.com/solidusio-contrib/solidus_related_products/blob/master/LICENSE.md
78
+ [4]: https://github.com/solidusio-contrib/solidus_related_products/blob/master/CONTRIBUTING.md
79
79
  [5]: https://github.com/BDQ
80
- [6]: https://github.com/spree-contrib/spree_related_products/graphs/contributors
80
+ [6]: https://github.com/solidusio-contrib/solidus_related_products/graphs/contributors
data/Rakefile CHANGED
@@ -6,7 +6,13 @@ require 'spree/testing_support/common_rake'
6
6
 
7
7
  RSpec::Core::RakeTask.new
8
8
 
9
- task default: :spec
9
+ task :default do
10
+ if Dir["spec/dummy"].empty?
11
+ Rake::Task[:test_app].invoke
12
+ Dir.chdir("../../")
13
+ end
14
+ Rake::Task[:spec].invoke
15
+ end
10
16
 
11
17
  desc 'Generates a dummy app for testing'
12
18
  task :test_app do
@@ -38,7 +38,7 @@ module Spree
38
38
 
39
39
  respond_with(@relation) do |format|
40
40
  format.html { redirect_to location_after_destroy }
41
- format.js { render :partial => "spree/admin/shared/destroy" }
41
+ format.js { render partial: "spree/admin/shared/destroy" }
42
42
  end
43
43
 
44
44
  else
@@ -14,17 +14,17 @@ module Spree
14
14
 
15
15
  return unless eligible?(order)
16
16
  total = order.line_items.inject(0) do |sum, line_item|
17
- relations = Spree::Relation.where(*discount_query(line_item))
18
- discount_applies_to = relations.map {|rel| rel.related_to.master }
17
+ relations = Spree::Relation.where(*discount_query(line_item))
18
+ discount_applies_to = relations.map { |rel| rel.related_to.master }
19
19
 
20
20
  order.line_items.each do |li|
21
- next unless discount_applies_to.include? li.variant
21
+ next li unless discount_applies_to.include? li.variant
22
22
  discount = relations.detect { |rel| rel.related_to.master == li.variant }.discount_amount
23
- sum += if li.quantity < line_item.quantity
24
- (discount * li.quantity)
25
- else
26
- (discount * line_item.quantity)
27
- end
23
+ sum += if li.quantity < line_item.quantity
24
+ (discount * li.quantity)
25
+ else
26
+ (discount * line_item.quantity)
27
+ end
28
28
  end
29
29
 
30
30
  sum
@@ -101,6 +101,6 @@ Spree::Product.class_eval do
101
101
  end
102
102
 
103
103
  def format_name(name)
104
- name.to_s.downcase.gsub(' ', '_').pluralize
104
+ name.to_s.downcase.tr(' ', '_').pluralize
105
105
  end
106
106
  end
@@ -1,3 +1,3 @@
1
1
  <li<%== ' class="active"' if current == "Related Products" %>>
2
- <%= link_to_with_icon 'resize-small', Spree.t(:related_products), related_admin_product_url(@product) %>
3
- </li>
2
+ <%= link_to_with_icon 'share-alt', Spree.t(:related_products), related_admin_product_url(@product) %>
3
+ </li>
@@ -25,12 +25,9 @@
25
25
  <td><%= relation.relation_type.name %></td>
26
26
  <td>
27
27
  <%= form_for relation, url: admin_product_relation_path(relation.relatable, relation) do |f| %>
28
- <div class="input-group">
29
- <%= f.text_field :discount_amount, class: 'form-control text-center' %>
30
- <span class="input-group-btn">
31
- <%= f.button Spree.t(:update), type: 'submit', class: 'btn btn-primary' %>
32
- </span>
33
- </div>
28
+
29
+ <%= f.text_field :discount_amount, class: 'form-control text-center' %>
30
+ <%= f.button Spree.t(:update), type: 'submit', class: 'button btn-primary' %>
34
31
  <% end %>
35
32
  </td>
36
33
  <td class="actions">
@@ -7,34 +7,38 @@
7
7
  <%= Spree.t(:no_relation_types) %>
8
8
  </div>
9
9
  <% else %>
10
+
10
11
  <div id="add-line-item">
11
12
  <fieldset>
12
13
  <legend><%= Spree.t(:add_related_product) %></legend>
13
14
  <div class="row">
14
- <div id="related_product_name" class="col-md-5">
15
+ <div id="related_product_name" class="">
15
16
  <div class="form-group">
16
17
  <%= label_tag :add_variant_name, Spree.t(:name_or_sku_short) %>
17
18
  <%= hidden_field_tag :add_variant_name, '', class: 'variant_autocomplete', style: "display: block !important;" %>
18
19
  </div>
19
20
  </div>
20
- <div id="related_product_type" class="col-md-4">
21
+
22
+ <div id="related_product_type" class="column">
21
23
  <div class="form-group">
22
24
  <%= label_tag :add_type, Spree.t(:type) %>
23
- <%= select_tag :add_type, options_for_select(@relation_types.map { |rt| [rt.name, rt.id] }), class: 'select2' %>
25
+ <%= select_tag :add_type, options_for_select(@relation_types.map { |rt| [rt.name, rt.id] }), class: 'select2', style: "display: block" %>
24
26
  </div>
25
27
  </div>
26
- <div id="related_product_discount" class="col-md-3">
28
+
29
+ <div id="related_product_discount" class="four width column">
27
30
  <div class="form-group">
28
31
  <%= label_tag :add_discount, Spree.t(:discount_amount) %>
29
- <div class="input-group">
30
- <%= text_field_tag :add_discount, 0.0, class: 'form-control text-center' %>
31
- <span class="input-group-btn">
32
- <%= button_link_to Spree.t(:add), admin_product_relations_url(@product), icon: 'add', class: 'btn-success', id: 'add_related_product', data: { update: 'products-table-wrapper' } %>
33
- </span>
34
- </div>
32
+ <%= text_field_tag :add_discount, 0.0, class: 'form-control text-center' %>
35
33
  </div>
36
34
  </div>
35
+
37
36
  </div>
37
+ <div class='row'>
38
+ <div class='column'>
39
+ <%= button_link_to Spree.t(:add), admin_product_relations_url(@product), icon: 'add', id: 'add_related_product', data: { update: 'products-table-wrapper' } %>
40
+ <div>
41
+ <div>
38
42
  </fieldset>
39
43
  </div>
40
44
 
data/bin/rails CHANGED
@@ -4,4 +4,4 @@ ENGINE_ROOT = File.expand_path('../..', __FILE__)
4
4
  ENGINE_PATH = File.expand_path('../../lib/spree_related_products/engine', __FILE__)
5
5
 
6
6
  require 'rails/all'
7
- require 'rails/engine/commands'
7
+ require 'rails/engine/commands'
@@ -16,3 +16,6 @@ de:
16
16
  add_related_product: Verwandtes Produkt hinzufügen
17
17
  name_or_sku_short: Name oder Artikelnummer
18
18
  no_relation_types: "Sie müssen Verwandschaftstypen konfigurieren, bevor Sie diese Funktion nutzen können."
19
+ admin:
20
+ tab:
21
+ relation_types: Verwandschaftstypen
@@ -1,4 +1,4 @@
1
- Spree::Core::Engine.add_routes do
1
+ Spree::Core::Engine.routes.draw do
2
2
  namespace :admin do
3
3
  resources :relation_types
4
4
  resources :products, only: [] do
@@ -8,7 +8,7 @@ module SolidusRelatedProducts
8
8
  end
9
9
 
10
10
  def run_migrations
11
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
11
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
12
12
  if run_migrations
13
13
  run 'bundle exec rake db:migrate'
14
14
  else
@@ -9,7 +9,7 @@ module SolidusRelatedProducts
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 0
12
+ MINOR = 1
13
13
  TINY = 0
14
14
  PRE = nil
15
15
 
@@ -23,8 +23,8 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.has_rdoc = false
25
25
 
26
- s.add_runtime_dependency 'solidus_backend', '~> 1.0'
27
- s.add_runtime_dependency 'deface'
26
+ s.add_runtime_dependency 'solidus_backend', ['>= 1.0', '< 3']
27
+ s.add_runtime_dependency 'deface', '~> 1.0'
28
28
 
29
29
  s.add_development_dependency 'factory_girl', '~> 4.5'
30
30
  s.add_development_dependency 'ffaker'
@@ -36,10 +36,6 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency 'shoulda-matchers', '~> 2.5'
37
37
  s.add_development_dependency 'simplecov', '~> 0.9'
38
38
  s.add_development_dependency 'database_cleaner', '~> 1.3'
39
- s.add_development_dependency 'coffee-rails'
40
- s.add_development_dependency 'sass-rails'
41
- s.add_development_dependency 'guard-rspec'
42
- s.add_development_dependency 'pry-rails'
43
39
  s.add_development_dependency 'rubocop', '>= 0.24.1'
44
40
  s.add_development_dependency 'rspec-activemodel-mocks'
45
41
  end
@@ -39,6 +39,8 @@ RSpec.describe Spree::Admin::RelationsController, type: :controller do
39
39
  }
40
40
  end
41
41
 
42
+ let(:invalid_params) { { format: :js, product_id: product.id } }
43
+
42
44
  context '#create' do
43
45
  it 'is not routable' do
44
46
  spree_post :create, valid_params
@@ -53,14 +55,14 @@ RSpec.describe Spree::Admin::RelationsController, type: :controller do
53
55
 
54
56
  it 'raises error with invalid params' do
55
57
  expect {
56
- spree_post :create, format: :js
57
- }.to raise_error
58
+ spree_post :create, invalid_params
59
+ }.to raise_error(ActionController::ParameterMissing)
58
60
  end
59
61
  end
60
62
 
61
63
  context '#update' do
62
64
  it 'redirects to product/related url' do
63
- spree_put :update, product_id: product.id, id: 1, relation: { discount_amount: 2.0 }
65
+ spree_put :update, product_id: product.id, id: relation.id, relation: { discount_amount: 2.0 }
64
66
  expect(response).to redirect_to(spree.admin_product_path(relation.relatable) + '/related')
65
67
  end
66
68
  end
@@ -68,7 +70,7 @@ RSpec.describe Spree::Admin::RelationsController, type: :controller do
68
70
  context '#destroy' do
69
71
  it 'records successfully' do
70
72
  expect {
71
- spree_delete :destroy, id: 1, product_id: product.id, format: :js
73
+ spree_delete :destroy, id: relation.id, product_id: product.id, format: :js
72
74
  }.to change(Spree::Relation, :count).by(-1)
73
75
  end
74
76
  end
@@ -70,7 +70,7 @@ RSpec.describe Spree::Api::RelationsController, type: :controller do
70
70
  context '#destroy with' do
71
71
  it 'records successfully' do
72
72
  expect {
73
- spree_delete :destroy, id: 1, product_id: product.id, format: :json, token: user.spree_api_key
73
+ spree_delete :destroy, id: relation.id, product_id: product.id, format: :json, token: user.spree_api_key
74
74
  }.to change(Spree::Relation, :count).by(-1)
75
75
  end
76
76
  end
@@ -12,7 +12,7 @@ RSpec.feature 'Admin Product Relation', :js do
12
12
  end
13
13
 
14
14
  scenario 'create relation' do
15
- expect(page).to have_text 'ADD RELATED PRODUCT'
15
+ expect(page).to have_text /ADD RELATED PRODUCT/i
16
16
  expect(page).to have_text product.name
17
17
 
18
18
  within('#add-line-item') do
@@ -48,7 +48,7 @@ RSpec.feature 'Admin Product Relation', :js do
48
48
  end
49
49
 
50
50
  scenario 'ensure content exist' do
51
- expect(page).to have_text 'ADD RELATED PRODUCT'
51
+ expect(page).to have_text /ADD RELATED PRODUCT/i
52
52
  expect(page).to have_text product.name
53
53
  expect(page).to have_text other.name
54
54
 
@@ -6,7 +6,7 @@ RSpec.feature 'Admin Relation Types', :js do
6
6
  end
7
7
 
8
8
  scenario 'when no relation types exists' do
9
- expect(page).to have_text 'NO RELATION TYPES FOUND, ADD ONE!'
9
+ expect(page).to have_text /NO RELATION TYPES FOUND, ADD ONE!/i
10
10
  end
11
11
 
12
12
  context 'create' do
@@ -35,9 +35,9 @@ RSpec.describe Spree::Calculator::RelatedProductDiscount, type: :model do
35
35
  create(:relation, relatable: product, related_to: related_product, relation_type: relation_type, discount_amount: 1.0)
36
36
  end
37
37
 
38
+ # TODO: figure out what this test is trying to accomplish
38
39
  it 'returns total count of Array' do
39
- objects = Array.new { @order }
40
- expect(subject.compute(objects)).to be_nil
40
+ expect(subject.compute([])).to be_nil
41
41
  end
42
42
 
43
43
  it 'returns total count' do
@@ -114,16 +114,4 @@ RSpec.describe Spree::Product, type: :model do
114
114
  end
115
115
  end
116
116
  end
117
-
118
- context 'instance when relation_types table is missing' do
119
- it 'method missing should not throw ActiveRecord::StatementInvalid when the spree_relation_types table is missing' do
120
- described_class.connection.rename_table('spree_relation_types', 'missing_relation_types')
121
- begin
122
- product = described_class.new
123
- expect { product.foo }.to raise_error(NameError)
124
- ensure
125
- described_class.connection.rename_table('missing_relation_types', 'spree_relation_types')
126
- end
127
- end
128
- end
129
117
  end
@@ -12,7 +12,7 @@ RSpec.describe Spree::RelationType, type: :model do
12
12
  create(:relation_type, name: 'Gears')
13
13
  expect {
14
14
  create(:relation_type, name: 'gears')
15
- }.to raise_error
15
+ }.to raise_error(ActiveRecord::RecordInvalid)
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_related_products
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Quinn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-15 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_backend
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: deface
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '1.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '1.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: factory_girl
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -178,62 +184,6 @@ dependencies:
178
184
  - - "~>"
179
185
  - !ruby/object:Gem::Version
180
186
  version: '1.3'
181
- - !ruby/object:Gem::Dependency
182
- name: coffee-rails
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: sass-rails
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: guard-rspec
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
- - !ruby/object:Gem::Dependency
224
- name: pry-rails
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - ">="
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - ">="
235
- - !ruby/object:Gem::Version
236
- version: '0'
237
187
  - !ruby/object:Gem::Dependency
238
188
  name: rubocop
239
189
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +225,6 @@ files:
275
225
  - ".travis.yml"
276
226
  - CONTRIBUTING.md
277
227
  - Gemfile
278
- - Guardfile
279
228
  - LICENSE.md
280
229
  - README.md
281
230
  - Rakefile
data/Guardfile DELETED
@@ -1,10 +0,0 @@
1
- guard 'rspec', cmd: 'bundle exec rspec' do
2
- watch('spec/spec_helper.rb') { 'spec' }
3
- watch('config/routes.rb') { 'spec/controllers' }
4
- watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
5
- watch(%r{^app/(.+)_decorator\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
6
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch(%r{^app/(.*)(\.erb)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
8
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
9
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" }
10
- end