spree_favorite_products 2.3.0 → 3.0.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: cba77e7e7f4b1bf6977e5064ca0954ba99eac719
4
- data.tar.gz: a10d97d7602d782c7d52e45ad5eaf7e34e5c6ea0
3
+ metadata.gz: f11f3c8880f83651bdb24fe9c818946085b4d8d0
4
+ data.tar.gz: 6628a06e36d08be97e9c6fd6b567b8f9228c1a78
5
5
  SHA512:
6
- metadata.gz: 3cfa733b36313aac41f671f8e48a097ece12f9bc36e21b2880e51d4a029f459dc962cda11d82d9b79f3c0e095c5ffec089bd73653e87f5ef22a45771a63d889d
7
- data.tar.gz: 855b9720e169b3483dce2491eb8834744a608fe78c662ca51fa5cdc259a938f3e0a4ba8205869bee471f7563afe66e25a1dc706f8eb435ec39898460187000ff
6
+ metadata.gz: 6fe013be6540e9c4797b8a71ec3f0c87d8f52841a8cfe18639a380bc4cd7e1b6d99cebd41730d1a16ff3910339d99b516a6213747a4220b56f2add2040803a09
7
+ data.tar.gz: 0d72ec7b52bb628f6b0e67fc056da1c79b610c90264257f4a129a448f48572dbb1aa87e1e6bcf2ee85ac3fd5119440cbd6def1350de2def05fd884e2f87afe24
data/.gitignore CHANGED
@@ -1 +1,4 @@
1
- .ruby-version
1
+ /spec/dummy
2
+ /coverage
3
+ .DS_STORE
4
+ .ruby-version
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - ruby-1.9.3
3
+ - ruby-2.1.6
4
4
  script:
5
5
  - bundle exec rake test_app
6
- - bundle exec rspec .
6
+ - bundle exec rspec spec
data/Gemfile CHANGED
@@ -1,18 +1,18 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Provides basic authentication functionality for testing parts of your engine
4
- gem 'spree', '2.3.0'
5
- gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-3-stable'
4
+ gem 'spree', '~> 3.0.0'
5
+ gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
6
6
  gem 'mysql2'
7
+ gem 'sass-rails', '~> 5.0'
7
8
 
8
- group :assets do
9
+ group :assets do
9
10
  gem 'coffee-rails', '4.0.1'
10
- gem 'sass-rails'
11
11
  end
12
12
 
13
13
  group :test do
14
14
  gem 'rspec-rails', '~> 2.10'
15
- gem 'shoulda-matchers', '2.6.0'
15
+ gem 'shoulda-matchers', '2.2.0'
16
16
  gem 'simplecov', :require => false
17
17
  gem 'database_cleaner'
18
18
  end
data/Gemfile.lock CHANGED
@@ -1,75 +1,85 @@
1
1
  GIT
2
2
  remote: git://github.com/spree/spree_auth_devise.git
3
- revision: b3b63f1fa01e8ccce300b663f8405fd190d9d9ba
4
- branch: 2-3-stable
3
+ revision: f231fce43686d66fe3e6d65ba8595b4474c49895
4
+ branch: 3-0-stable
5
5
  specs:
6
- spree_auth_devise (2.3.0)
7
- devise (~> 3.2.3)
6
+ spree_auth_devise (3.0.0)
7
+ devise (~> 3.4.1)
8
8
  devise-encryptable (= 0.1.2)
9
9
  json
10
10
  multi_json
11
- spree_core (~> 2.3.0)
11
+ spree_core (~> 3.0.0)
12
12
 
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- spree_favorite_products (2.3.0)
17
- spree_core (~> 2.3.0)
16
+ spree_favorite_products (2.2.3)
17
+ spree_core (~> 3.0.0)
18
18
 
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actionmailer (4.1.14)
23
- actionpack (= 4.1.14)
24
- actionview (= 4.1.14)
22
+ actionmailer (4.2.5)
23
+ actionpack (= 4.2.5)
24
+ actionview (= 4.2.5)
25
+ activejob (= 4.2.5)
25
26
  mail (~> 2.5, >= 2.5.4)
26
- actionpack (4.1.14)
27
- actionview (= 4.1.14)
28
- activesupport (= 4.1.14)
29
- rack (~> 1.5.2)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ actionpack (4.2.5)
29
+ actionview (= 4.2.5)
30
+ activesupport (= 4.2.5)
31
+ rack (~> 1.6)
30
32
  rack-test (~> 0.6.2)
31
- actionview (4.1.14)
32
- activesupport (= 4.1.14)
33
+ rails-dom-testing (~> 1.0, >= 1.0.5)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
35
+ actionview (4.2.5)
36
+ activesupport (= 4.2.5)
33
37
  builder (~> 3.1)
34
38
  erubis (~> 2.7.0)
35
- active_utils (2.2.3)
36
- activesupport (>= 2.3.11)
37
- i18n
38
- activemerchant (1.43.3)
39
- active_utils (~> 2.0, >= 2.0.1)
40
- activesupport (>= 2.3.14, < 5.0.0)
39
+ rails-dom-testing (~> 1.0, >= 1.0.5)
40
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
41
+ activejob (4.2.5)
42
+ activesupport (= 4.2.5)
43
+ globalid (>= 0.3.0)
44
+ activemerchant (1.47.0)
45
+ activesupport (>= 3.2.14, < 5.0.0)
41
46
  builder (>= 2.1.2, < 4.0.0)
42
- i18n (~> 0.5)
43
- json (~> 1.7)
44
- money (< 7.0.0)
47
+ i18n (>= 0.6.9)
45
48
  nokogiri (~> 1.4)
46
- activemodel (4.1.14)
47
- activesupport (= 4.1.14)
49
+ activemodel (4.2.5)
50
+ activesupport (= 4.2.5)
48
51
  builder (~> 3.1)
49
- activerecord (4.1.14)
50
- activemodel (= 4.1.14)
51
- activesupport (= 4.1.14)
52
- arel (~> 5.0.0)
53
- activesupport (4.1.14)
54
- i18n (~> 0.6, >= 0.6.9)
52
+ activerecord (4.2.5)
53
+ activemodel (= 4.2.5)
54
+ activesupport (= 4.2.5)
55
+ arel (~> 6.0)
56
+ activesupport (4.2.5)
57
+ i18n (~> 0.7)
55
58
  json (~> 1.7, >= 1.7.7)
56
59
  minitest (~> 5.1)
57
- thread_safe (~> 0.1)
60
+ thread_safe (~> 0.3, >= 0.3.4)
58
61
  tzinfo (~> 1.1)
59
- acts_as_list (0.3.0)
62
+ acts_as_list (0.7.2)
60
63
  activerecord (>= 3.0)
61
- arel (5.0.1.20140414130214)
64
+ addressable (2.3.8)
65
+ arel (6.0.3)
66
+ autoprefixer-rails (6.1.1)
67
+ execjs
68
+ json
62
69
  awesome_nested_set (3.0.2)
63
70
  activerecord (>= 4.0.0, < 5)
64
- aws-sdk (1.27.0)
65
- json (~> 1.4)
66
- nokogiri (>= 1.4.4)
67
- uuidtools (~> 2.1)
68
71
  bcrypt (3.1.10)
72
+ bootstrap-sass (3.3.6)
73
+ autoprefixer-rails (>= 5.2.1)
74
+ sass (>= 3.3.4)
69
75
  builder (3.2.2)
70
- cancan (1.6.10)
76
+ camertron-eprun (1.1.0)
77
+ cancancan (1.10.1)
71
78
  canonical-rails (0.0.11)
72
79
  rails (>= 3.1, < 5.0)
80
+ carmen (1.0.2)
81
+ activesupport (>= 3.0.0)
82
+ cldr-plurals-runtime-rb (1.0.1)
73
83
  climate_control (0.0.3)
74
84
  activesupport (>= 3.0)
75
85
  cocaine (0.5.8)
@@ -82,16 +92,19 @@ GEM
82
92
  execjs
83
93
  coffee-script-source (1.10.0)
84
94
  colorize (0.7.7)
95
+ css_parser (1.3.7)
96
+ addressable
85
97
  database_cleaner (1.5.1)
86
98
  deface (1.0.2)
87
99
  colorize (>= 0.5.8)
88
100
  nokogiri (~> 1.6.0)
89
101
  polyglot
90
102
  rails (>= 3.1)
91
- devise (3.2.4)
103
+ devise (3.4.1)
92
104
  bcrypt (~> 3.0)
93
105
  orm_adapter (~> 0.1)
94
106
  railties (>= 3.2.6, < 5)
107
+ responders
95
108
  thread_safe (~> 0.1)
96
109
  warden (~> 1.2.3)
97
110
  devise-encryptable (0.1.2)
@@ -103,22 +116,28 @@ GEM
103
116
  ffaker (1.32.1)
104
117
  font-awesome-rails (4.5.0.0)
105
118
  railties (>= 3.2, < 5.0)
106
- friendly_id (5.0.5)
119
+ friendly_id (5.1.0)
107
120
  activerecord (>= 4.0.0)
121
+ globalid (0.3.6)
122
+ activesupport (>= 4.1.0)
108
123
  highline (1.6.21)
124
+ htmlentities (4.3.4)
109
125
  httparty (0.13.7)
110
126
  json (~> 1.8)
111
127
  multi_xml (>= 0.5.2)
112
- i18n (0.6.9)
113
- jquery-rails (3.1.4)
114
- railties (>= 3.0, < 5.0)
128
+ i18n (0.7.0)
129
+ jquery-rails (4.0.5)
130
+ rails-dom-testing (~> 1.0)
131
+ railties (>= 4.2.0)
115
132
  thor (>= 0.14, < 2.0)
116
- jquery-ui-rails (4.1.2)
117
- railties (>= 3.1.0)
133
+ jquery-ui-rails (5.0.5)
134
+ railties (>= 3.2.16)
118
135
  json (1.8.3)
119
- kaminari (0.15.1)
136
+ kaminari (0.16.3)
120
137
  actionpack (>= 3.0.0)
121
138
  activesupport (>= 3.0.0)
139
+ loofah (2.0.3)
140
+ nokogiri (>= 1.5.9)
122
141
  mail (2.6.3)
123
142
  mime-types (>= 1.16, < 3)
124
143
  mime-types (2.99)
@@ -134,43 +153,60 @@ GEM
134
153
  nokogiri (1.6.7)
135
154
  mini_portile2 (~> 2.0.0.rc2)
136
155
  orm_adapter (0.5.0)
137
- paperclip (4.1.1)
138
- activemodel (>= 3.0.0)
139
- activesupport (>= 3.0.0)
140
- cocaine (~> 0.5.3)
156
+ paperclip (4.2.4)
157
+ activemodel (>= 3.2.0)
158
+ activesupport (>= 3.2.0)
159
+ cocaine (~> 0.5.5)
141
160
  mime-types
142
161
  paranoia (2.1.4)
143
162
  activerecord (~> 4.0)
144
- polyamorous (1.0.0)
163
+ polyamorous (1.2.0)
145
164
  activerecord (>= 3.0)
146
165
  polyglot (0.3.5)
166
+ premailer (1.8.6)
167
+ css_parser (>= 1.3.6)
168
+ htmlentities (>= 4.0.0)
169
+ premailer-rails (1.8.2)
170
+ actionmailer (>= 3, < 5)
171
+ premailer (~> 1.7, >= 1.7.9)
147
172
  rabl (0.9.4.pre1)
148
173
  activesupport (>= 2.3.14)
149
- rack (1.5.5)
174
+ rack (1.6.4)
150
175
  rack-test (0.6.3)
151
176
  rack (>= 1.0)
152
- rails (4.1.14)
153
- actionmailer (= 4.1.14)
154
- actionpack (= 4.1.14)
155
- actionview (= 4.1.14)
156
- activemodel (= 4.1.14)
157
- activerecord (= 4.1.14)
158
- activesupport (= 4.1.14)
177
+ rails (4.2.5)
178
+ actionmailer (= 4.2.5)
179
+ actionpack (= 4.2.5)
180
+ actionview (= 4.2.5)
181
+ activejob (= 4.2.5)
182
+ activemodel (= 4.2.5)
183
+ activerecord (= 4.2.5)
184
+ activesupport (= 4.2.5)
159
185
  bundler (>= 1.3.0, < 2.0)
160
- railties (= 4.1.14)
161
- sprockets-rails (~> 2.0)
162
- railties (4.1.14)
163
- actionpack (= 4.1.14)
164
- activesupport (= 4.1.14)
186
+ railties (= 4.2.5)
187
+ sprockets-rails
188
+ rails-deprecated_sanitizer (1.0.3)
189
+ activesupport (>= 4.2.0.alpha)
190
+ rails-dom-testing (1.0.7)
191
+ activesupport (>= 4.2.0.beta, < 5.0)
192
+ nokogiri (~> 1.6.0)
193
+ rails-deprecated_sanitizer (>= 1.0.1)
194
+ rails-html-sanitizer (1.0.2)
195
+ loofah (~> 2.0)
196
+ railties (4.2.5)
197
+ actionpack (= 4.2.5)
198
+ activesupport (= 4.2.5)
165
199
  rake (>= 0.8.7)
166
200
  thor (>= 0.18.1, < 2.0)
167
201
  rake (10.4.2)
168
- ransack (1.2.3)
202
+ ransack (1.4.1)
169
203
  actionpack (>= 3.0)
170
204
  activerecord (>= 3.0)
171
205
  activesupport (>= 3.0)
172
206
  i18n
173
- polyamorous (~> 1.0.0)
207
+ polyamorous (~> 1.1)
208
+ responders (2.1.0)
209
+ railties (>= 4.2.0, < 5)
174
210
  rspec-collection_matchers (1.1.2)
175
211
  rspec-expectations (>= 2.99.0.beta1)
176
212
  rspec-core (2.99.2)
@@ -193,80 +229,95 @@ GEM
193
229
  sprockets (>= 2.8, < 4.0)
194
230
  sprockets-rails (>= 2.0, < 4.0)
195
231
  tilt (>= 1.1, < 3)
196
- select2-rails (3.5.9.3)
232
+ select2-rails (3.5.9.1)
197
233
  thor (~> 0.14)
198
- shoulda-matchers (2.6.0)
234
+ shoulda-matchers (2.2.0)
199
235
  activesupport (>= 3.0.0)
200
- simplecov (0.11.1)
236
+ simplecov (0.11.0)
201
237
  docile (~> 1.1.0)
202
238
  json (~> 1.8)
203
239
  simplecov-html (~> 0.10.0)
204
240
  simplecov-html (0.10.0)
205
- spree (2.3.0)
206
- spree_api (= 2.3.0)
207
- spree_backend (= 2.3.0)
208
- spree_cmd (= 2.3.0)
209
- spree_core (= 2.3.0)
210
- spree_frontend (= 2.3.0)
211
- spree_sample (= 2.3.0)
212
- spree_api (2.3.0)
241
+ spree (3.0.4)
242
+ spree_api (= 3.0.4)
243
+ spree_backend (= 3.0.4)
244
+ spree_cmd (= 3.0.4)
245
+ spree_core (= 3.0.4)
246
+ spree_frontend (= 3.0.4)
247
+ spree_sample (= 3.0.4)
248
+ spree_api (3.0.4)
213
249
  rabl (~> 0.9.4.pre1)
214
- spree_core (= 2.3.0)
250
+ spree_core (= 3.0.4)
215
251
  versioncake (~> 2.3.1)
216
- spree_backend (2.3.0)
217
- jquery-rails (~> 3.1.0)
218
- jquery-ui-rails (~> 4.1.0)
219
- select2-rails (~> 3.5.0)
220
- spree_api (= 2.3.0)
221
- spree_core (= 2.3.0)
222
- spree_cmd (2.3.0)
252
+ spree_backend (3.0.4)
253
+ bootstrap-sass (~> 3.3.1)
254
+ jquery-rails (~> 4.0.3)
255
+ jquery-ui-rails (~> 5.0.0)
256
+ select2-rails (= 3.5.9.1)
257
+ spree_api (= 3.0.4)
258
+ spree_core (= 3.0.4)
259
+ sprockets-rails (~> 2.2)
260
+ spree_cmd (3.0.4)
223
261
  thor (~> 0.14)
224
- spree_core (2.3.0)
225
- activemerchant (~> 1.43.1)
226
- acts_as_list (= 0.3.0)
227
- awesome_nested_set (~> 3.0.0.rc.3)
228
- aws-sdk (= 1.27.0)
229
- cancan (~> 1.6.10)
262
+ spree_core (3.0.4)
263
+ activemerchant (~> 1.47.0)
264
+ acts_as_list (~> 0.6)
265
+ awesome_nested_set (~> 3.0.1)
266
+ cancancan (~> 1.10.1)
267
+ carmen (~> 1.0.0)
230
268
  deface (~> 1.0.0)
231
269
  ffaker (~> 1.16)
232
270
  font-awesome-rails (~> 4.0)
233
- friendly_id (~> 5.0.4)
271
+ friendly_id (~> 5.1.0)
234
272
  highline (~> 1.6.18)
235
273
  httparty (~> 0.11)
236
- i18n (= 0.6.9)
237
274
  json (~> 1.7)
238
- kaminari (~> 0.15.0)
239
- monetize
240
- paperclip (~> 4.1.1)
241
- paranoia (~> 2.0)
242
- rails (~> 4.1.2)
243
- ransack (~> 1.2.2)
244
- state_machine (= 1.2.0)
245
- stringex (~> 1.5.1)
275
+ kaminari (~> 0.15, >= 0.15.1)
276
+ monetize (~> 1.1)
277
+ paperclip (~> 4.2.0)
278
+ paranoia (~> 2.1.0)
279
+ premailer-rails
280
+ rails (~> 4.2.2)
281
+ ransack (~> 1.4.1)
282
+ responders
283
+ state_machines-activerecord (~> 0.2)
284
+ stringex
246
285
  truncate_html (= 0.9.2)
247
- spree_frontend (2.3.0)
286
+ twitter_cldr (~> 3.0)
287
+ spree_frontend (3.0.4)
288
+ bootstrap-sass (~> 3.3.1)
248
289
  canonical-rails (~> 0.0.4)
249
- jquery-rails (~> 3.1.0)
250
- spree_api (= 2.3.0)
251
- spree_core (= 2.3.0)
252
- stringex (~> 1.5.1)
253
- spree_sample (2.3.0)
254
- spree_core (= 2.3.0)
290
+ jquery-rails (~> 4.0.3)
291
+ spree_api (= 3.0.4)
292
+ spree_core (= 3.0.4)
293
+ sprockets-rails (~> 2.2)
294
+ spree_sample (3.0.4)
295
+ spree_core (= 3.0.4)
255
296
  sprockets (3.4.1)
256
297
  rack (> 1, < 3)
257
298
  sprockets-rails (2.3.3)
258
299
  actionpack (>= 3.0)
259
300
  activesupport (>= 3.0)
260
301
  sprockets (>= 2.8, < 4.0)
261
- state_machine (1.2.0)
262
- stringex (1.5.1)
302
+ state_machines (0.4.0)
303
+ state_machines-activemodel (0.3.0)
304
+ activemodel (~> 4.1)
305
+ state_machines (>= 0.4.0)
306
+ state_machines-activerecord (0.3.0)
307
+ activerecord (~> 4.1)
308
+ state_machines-activemodel (>= 0.3.0)
309
+ stringex (2.5.2)
263
310
  thor (0.19.1)
264
311
  thread_safe (0.3.5)
265
312
  tilt (2.0.1)
266
313
  truncate_html (0.9.2)
314
+ twitter_cldr (3.2.1)
315
+ camertron-eprun
316
+ cldr-plurals-runtime-rb (~> 1.0.0)
317
+ json
318
+ tzinfo
267
319
  tzinfo (1.2.2)
268
320
  thread_safe (~> 0.1)
269
- uuidtools (2.1.5)
270
321
  versioncake (2.3.1)
271
322
  actionpack (>= 3.2)
272
323
  activesupport (>= 3.2)
@@ -283,10 +334,10 @@ DEPENDENCIES
283
334
  database_cleaner
284
335
  mysql2
285
336
  rspec-rails (~> 2.10)
286
- sass-rails
287
- shoulda-matchers (= 2.6.0)
337
+ sass-rails (~> 5.0)
338
+ shoulda-matchers (= 2.2.0)
288
339
  simplecov
289
- spree (= 2.3.0)
340
+ spree (~> 3.0.0)
290
341
  spree_auth_devise!
291
342
  spree_favorite_products!
292
343
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ This extension adds the following features:
5
5
 
6
6
  1. Adds a link 'Mark as favorite' on product detail page.
7
7
  2. Favorite Products tab on header
8
- 3. Favorite Products tab in admin section
8
+ 3. Favorite Products tab in admin section
9
9
 
10
10
  Installation
11
11
  ------------
@@ -13,10 +13,25 @@ Installation
13
13
  Add spree_favorite_products to your Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'spree_favorite_products', github: "vinsol/spree_favorite_products', branch: '2-3-stable'
16
+ gem 'spree_favorite_products', github: 'vinsol/spree_favorite_products', branch: '3-0-stable'
17
17
  ```
18
18
 
19
- This is for Spree version 2.3. For older versions of spree, use the correct branch.
19
+ For older versions of spree.
20
+
21
+ ```ruby
22
+ # Spree 2.2.x
23
+ gem 'spree_favorite_products', '2.2.3'
24
+ ```
25
+
26
+ ```ruby
27
+ # Spree 2.1.x
28
+ gem 'spree_favorite_products', '2.0.3'
29
+ ```
30
+
31
+ ```ruby
32
+ # Spree 2.0.x
33
+ gem 'spree_favorite_products', '1.0.0'
34
+ ```
20
35
 
21
36
  Bundle your dependencies and run the installation generator:
22
37
 
@@ -43,16 +58,6 @@ Simply add this require statement to your spec_helper:
43
58
  require 'spree_favorite_products/factories'
44
59
  ```
45
60
 
46
- Thought you should know:
47
- During the test app build, there will be two warnings that arise due to a habtm issue, see [rails issue #15022](https://github.com/rails/rails/issues/15022)
48
-
49
- ```shell
50
- /Users/deft/vendor/bundle/gems/activerecord-4.1.6/lib/active_record/associations.rb:1585: warning: already initialized constant Spree::ShippingMethod::HABTM_Zones
51
- /Users/deft/vendor/bundle/gems/activerecord-4.1.6/lib/active_record/associations.rb:1585: warning: previous definition of HABTM_Zones was here
52
- ```
53
- These warnings do not appear to interfere with functionality. Please let me know otherwise.
54
-
55
-
56
61
  Contributing
57
62
  ------------
58
63
 
@@ -1,10 +1,9 @@
1
1
  module Spree
2
2
  class Favorite < ActiveRecord::Base
3
3
  belongs_to :product
4
-
5
4
  belongs_to :user
6
5
  validates :user_id, :product_id, :presence => true
7
6
  validates :product_id, :uniqueness => { :scope => :user_id, :message => "already marked as favorite" }
8
7
  validates :product, :presence => { :message => "is invalid" }, :if => :product_id
9
8
  end
10
- end
9
+ end
@@ -1,16 +1,15 @@
1
1
  Deface::Override.new(
2
2
  :virtual_path => 'spree/admin/general_settings/edit',
3
3
  :name => 'add_favorite_products_per_page_configuration',
4
- :insert_after => "#preferences .row",
4
+ :insert_before => "#preferences fieldset .form-actions",
5
5
  :text => %Q{
6
6
  <div class="row">
7
- <fieldset class="no-border-bottom">
8
- <legend align="center"><%= Spree.t(:favorite_products_settings) %></legend>
9
- <div class="field">
10
- <%= label_tag :favorite_products_per_page, Spree.t(:favorite_products_per_page) %><br>
7
+ <div class="col-md-6">
8
+ <div class="form-group" data-hook="admin_general_setting_favorite_products_per_page">
9
+ <%= label_tag :favorite_products_per_page, Spree.t(:favorite_products_per_page) %>
11
10
  <%= text_field_tag :favorite_products_per_page, Spree::Config[:favorite_products_per_page], :size => 3 %>
12
11
  </div>
13
- </fieldset>
12
+ </div>
14
13
  </div>
15
14
  }
16
- )
15
+ )
@@ -1,11 +1,6 @@
1
1
  Deface::Override.new(
2
- :virtual_path => 'spree/admin/shared/_tabs',
2
+ :virtual_path => 'spree/admin/shared/sub_menu/_product',
3
3
  :name => 'select_products_tab',
4
- :replace => "erb[silent]:contains('if can? :admin, Spree::Product')",
5
- :closing_selector => "erb[silent]:contains('end')",
6
- :text => %Q{
7
- <% if can? :admin, Spree::Product %>
8
- <%= tab :products, :option_types, :properties, :prototypes, :variants, :product_properties, :taxonomies, :favorite_products, :icon => 'icon-th-large' %>
9
- <% end %>
10
- }
11
- )
4
+ :insert_bottom => "#sidebar-product",
5
+ :text => %Q{ <%= tab :favorite_products %> }
6
+ )
@@ -2,12 +2,10 @@
2
2
  <%= Spree.t(:listing_favorite_products) %>
3
3
  <% end %>
4
4
 
5
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
6
-
7
5
  <%= paginate @favorite_products %>
8
6
 
9
7
  <% if @favorite_products.any? %>
10
- <table class="index" id="listing_products">
8
+ <table class="table" id="listing_products">
11
9
  <colgroup>
12
10
  <col style="width: 15%;">
13
11
  <col style="width: 10%;">
@@ -43,4 +41,3 @@
43
41
  <% end %>
44
42
 
45
43
  <%= paginate @favorite_products %>
46
-
@@ -2,8 +2,6 @@
2
2
  <%= Spree.t(:listing_favorite_products_users) %>
3
3
  <% end %>
4
4
 
5
- <%= render :partial => 'spree/admin/shared/product_sub_menu' %>
6
-
7
5
  <%= paginate @users %>
8
6
 
9
7
  <% if @users.any? %>
@@ -29,4 +27,3 @@
29
27
  <% end %>
30
28
 
31
29
  <%= paginate @users %>
32
-
@@ -2,9 +2,8 @@
2
2
  # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
3
 
4
4
  en:
5
- hello: "Hello world"
6
5
  spree:
7
6
  favorite_products_settings: "Favorite Products Settings"
8
- favorite_products_per_page: "Per Page"
7
+ favorite_products_per_page: "Favorite Products Shown Per Page"
9
8
  mark_as_favorite: "Mark as favorite"
10
9
  unmark_as_favorite: "Unmark as favorite"
@@ -4,24 +4,27 @@ describe Spree::Admin::FavoriteProductsController do
4
4
  let(:role) { Spree::Role.create!(:name => 'user') }
5
5
  let(:roles) { [role] }
6
6
  let(:product) { mock_model( Spree::Product) }
7
+ let(:proxy_object) { Object.new }
7
8
 
8
9
  before(:each) do
9
10
  @user = mock_model(Spree::User, :generate_spree_api_key! => false)
10
- @user.stub_chain(:roles, :includes).and_return([])
11
- @user.stub(:has_spree_role?).with('admin').and_return(true)
12
- controller.stub(:spree_user_signed_in?).and_return(true)
13
- controller.stub(:spree_current_user).and_return(@user)
14
- @user.stub(:roles).and_return(roles)
15
- roles.stub(:includes).with(:permissions).and_return(roles)
16
- controller.stub(:authorize_admin).and_return(true)
17
- controller.stub(:authorize!).and_return(true)
11
+ allow(@user).to receive(:roles).and_return(proxy_object)
12
+ allow(proxy_object).to receive(:includes).and_return([])
13
+
14
+ allow(@user).to receive(:has_spree_role?).with('admin').and_return(true)
15
+ allow(controller).to receive(:spree_user_signed_in?).and_return(true)
16
+ allow(controller).to receive(:spree_current_user).and_return(@user)
17
+ allow(@user).to receive(:roles).and_return(roles)
18
+ allow(roles).to receive(:includes).with(:permissions).and_return(roles)
19
+ allow(controller).to receive(:authorize_admin).and_return(true)
20
+ allow(controller).to receive(:authorize!).and_return(true)
18
21
 
19
22
  @favorite_products = double('favorite_products')
20
- @favorite_products.stub(:order_by_favorite_users_count).and_return(@favorite_products)
23
+ allow(@favorite_products).to receive(:order_by_favorite_users_count).and_return(@favorite_products)
21
24
  @search = double('search', :result => @favorite_products)
22
- @favorite_products.stub(:search).and_return(@search)
23
- @favorite_products.stub(:page).and_return(@favorite_products)
24
- Spree::Product.stub(:favorite).and_return(@favorite_products)
25
+ allow(@favorite_products).to receive(:search).and_return(@search)
26
+ allow(@favorite_products).to receive(:page).and_return(@favorite_products)
27
+ allow(Spree::Product).to receive(:favorite).and_return(@favorite_products)
25
28
  end
26
29
 
27
30
  describe "GET index" do
@@ -76,10 +79,10 @@ describe Spree::Admin::FavoriteProductsController do
76
79
  describe "#users" do
77
80
  before do
78
81
  @users = [@user]
79
- @users.stub(:page).and_return(@users)
80
- product.stub(:favorite_users).and_return(@users)
82
+ allow(@users).to receive(:page).and_return(@users)
83
+ allow(product).to receive(:favorite_users).and_return(@users)
81
84
  @products = [product]
82
- Spree::Product.stub(:where).with(:id => product.id).and_return(@products)
85
+ allow(Spree::Product).to receive(:where).with(:id => product.id).and_return(@products)
83
86
  end
84
87
 
85
88
  def send_request
@@ -100,7 +103,7 @@ describe Spree::Admin::FavoriteProductsController do
100
103
  end
101
104
 
102
105
  describe "#sort_in_ascending_users_count?" do
103
-
106
+
104
107
  context 'when favorite_user_count asc present in params[q][s]' do
105
108
  it "is true" do
106
109
  get :index, :page => 1 ,:use_route => 'spree', :q => { 's' => 'favorite_users_count asc' }
@@ -111,8 +114,8 @@ describe Spree::Admin::FavoriteProductsController do
111
114
  context 'when favorite_user_count not present in params' do
112
115
  it "is false" do
113
116
  get :index, :page => 1 ,:use_route => 'spree', :q => { 's' => 'name asc' }
114
- controller.send(:sort_in_ascending_users_count?).should be_false
117
+ controller.send(:sort_in_ascending_users_count?).should be false
115
118
  end
116
119
  end
117
120
  end
118
- end
121
+ end
@@ -2,10 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe Spree::FavoriteProductsController do
4
4
 
5
+ let(:proxy_object) { Object.new }
6
+
5
7
  shared_examples_for "request which requires user authentication" do
6
8
  it "authenticates user" do
7
9
  controller.should_receive(:authenticate_spree_user!)
8
- send_request
10
+ send_request
9
11
  end
10
12
  end
11
13
 
@@ -33,15 +35,15 @@ describe Spree::FavoriteProductsController do
33
35
 
34
36
  before(:each) do
35
37
  @favorite = mock_model(Spree::Favorite, :save => true)
36
- controller.stub(:authenticate_spree_user!).and_return(true)
37
- Spree::Favorite.stub(:new).and_return(@favorite)
38
+ allow(controller).to receive(:authenticate_spree_user!).and_return(true)
39
+ allow(Spree::Favorite).to receive(:new).and_return(@favorite)
38
40
  @user = mock_model(Spree::User, :favorites => Spree::Favorite, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
39
- controller.stub(:spree_current_user).and_return(@user)
41
+ allow(controller).to receive(:spree_current_user).and_return(@user)
40
42
  end
41
43
 
42
44
  it_behaves_like "request which requires user authentication"
43
45
 
44
-
46
+
45
47
  it "creates favorite" do
46
48
  Spree::Favorite.should_receive(:new).with(:product_id => 1)
47
49
  send_request
@@ -66,8 +68,9 @@ describe Spree::FavoriteProductsController do
66
68
 
67
69
  context "when favorite not saved sucessfully" do
68
70
  before(:each) do
69
- @favorite.stub(:save).and_return(false)
70
- @favorite.stub_chain(:errors, :full_messages).and_return(["Product already marked as favorite"])
71
+ allow(@favorite).to receive(:save).and_return(false)
72
+ allow(@favorite).to receive(:errors).and_return(proxy_object)
73
+ allow(proxy_object).to receive(:full_messages).and_return(["Product already marked as favorite"])
71
74
  end
72
75
 
73
76
  it "renders create template" do
@@ -89,12 +92,12 @@ describe Spree::FavoriteProductsController do
89
92
 
90
93
  before(:each) do
91
94
  @favorite_products = double('favorite_products')
92
- @favorite_products.stub(:page).and_return(@favorite_products)
93
- @favorite_products.stub(:per).and_return(@favorite_products)
94
- Spree::Config.stub(:favorite_products_per_page).and_return('favorite_products_per_page')
95
+ allow(@favorite_products).to receive(:page).and_return(@favorite_products)
96
+ allow(@favorite_products).to receive(:per).and_return(@favorite_products)
97
+ allow(Spree::Config).to receive(:favorite_products_per_page).and_return('favorite_products_per_page')
95
98
  @user = mock_model(Spree::User, :favorite_products => @favorite_products, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
96
- controller.stub(:authenticate_spree_user!).and_return(true)
97
- controller.stub(:spree_current_user).and_return(@user)
99
+ allow(controller).to receive(:authenticate_spree_user!).and_return(true)
100
+ allow(controller).to receive(:spree_current_user).and_return(@user)
98
101
  end
99
102
 
100
103
  it "authenticates user" do
@@ -131,13 +134,13 @@ describe Spree::FavoriteProductsController do
131
134
  before do
132
135
  @favorite = mock_model(Spree::Favorite)
133
136
  @current_user_favorites = double('spree_favorites')
134
- @current_user_favorites.stub(:where).and_return([@favorite])
135
- @current_user_favorites.stub(:readonly).and_return(@current_user_favorites)
137
+ allow(@current_user_favorites).to receive(:where).and_return([@favorite])
138
+ allow(@current_user_favorites).to receive(:readonly).and_return(@current_user_favorites)
136
139
  @favorites = double('spree_favorites')
137
- @favorites.stub(:joins).with(:product).and_return(@current_user_favorites)
140
+ allow(@favorites).to receive(:joins).with(:product).and_return(@current_user_favorites)
138
141
  @user = mock_model(Spree::User, :favorites => @favorites, :generate_spree_api_key! => false, :last_incomplete_spree_order => nil)
139
- controller.stub(:authenticate_spree_user!).and_return(true)
140
- controller.stub(:spree_current_user).and_return(@user)
142
+ allow(controller).to receive(:authenticate_spree_user!).and_return(true)
143
+ allow(controller).to receive(:spree_current_user).and_return(@user)
141
144
  end
142
145
 
143
146
  it_behaves_like "request which requires user authentication"
@@ -155,18 +158,18 @@ describe Spree::FavoriteProductsController do
155
158
 
156
159
  context 'when destroyed successfully' do
157
160
  before(:each) do
158
- @favorite.stub(:destroy).and_return(true)
161
+ allow(@favorite).to receive(:destroy).and_return(true)
159
162
  end
160
163
 
161
164
  it "sets @success to true" do
162
165
  send_request
163
166
  assigns(:success).should eq(true)
164
- end
167
+ end
165
168
  end
166
169
 
167
170
  context 'when not destroyed' do
168
171
  before(:each) do
169
- @favorite.stub(:destroy).and_return(false)
172
+ allow(@favorite).to receive(:destroy).and_return(false)
170
173
  end
171
174
 
172
175
  it 'sets @success to false' do
@@ -177,4 +180,4 @@ describe Spree::FavoriteProductsController do
177
180
  end
178
181
 
179
182
  end
180
- end
183
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # Run Coverage report
2
2
  require 'simplecov'
3
+ require 'minitest/autorun'
4
+
3
5
  SimpleCov.start do
4
6
  add_group 'Controllers', 'app/controllers'
5
7
  add_group 'Helpers', 'app/helpers'
@@ -2,10 +2,10 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_favorite_products'
5
- s.version = '2.3.0'
5
+ s.version = '3.0.0'
6
6
  s.summary = 'Favorite Products in Spree'
7
7
  s.description = 'This extension adds the following features: 1. Adds a link Mark as favorite on product detail page. 2. Favorite Products tab on header 3. Favorite Products tab in admin section'
8
- s.required_ruby_version = '>= 1.9.3'
8
+ s.required_ruby_version = '>= 2.0.0'
9
9
 
10
10
  s.author = 'Mohit Bansal'
11
11
  s.email = 'info@vinsol.com'
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.require_path = 'lib'
18
18
  s.requirements << 'none'
19
19
 
20
- s.add_dependency 'spree_core', '~> 2.3.0'
20
+ s.add_dependency 'spree_core', '~> 3.0.0'
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_favorite_products
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohit Bansal
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.0
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.0
26
+ version: 3.0.0
27
27
  description: 'This extension adds the following features: 1. Adds a link Mark as favorite
28
28
  on product detail page. 2. Favorite Products tab on header 3. Favorite Products
29
29
  tab in admin section'
@@ -54,7 +54,6 @@ files:
54
54
  - app/models/spree/user_decorator.rb
55
55
  - app/overrides/.DS_Store
56
56
  - app/overrides/add_favorite_products_per_page_configuration.rb
57
- - app/overrides/add_favorite_products_tab.rb
58
57
  - app/overrides/add_favorite_products_to_products_tab.rb
59
58
  - app/overrides/add_link_to_mark_product_as_favorite.rb
60
59
  - app/overrides/add_link_to_users_favorite_products.rb
@@ -93,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
92
  requirements:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
- version: 1.9.3
95
+ version: 2.0.0
97
96
  required_rubygems_version: !ruby/object:Gem::Requirement
98
97
  requirements:
99
98
  - - ">="
@@ -1,6 +0,0 @@
1
- Deface::Override.new(
2
- :virtual_path => 'spree/admin/shared/_product_sub_menu',
3
- :name => 'add_favorite_products_tab',
4
- :insert_bottom => "ul#sub_nav",
5
- :text => "<%= tab :favorite_products %>"
6
- )