solidus_reviews 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -318
  3. data/.rubocop_todo.yml +221 -0
  4. data/CHANGELOG.md +100 -0
  5. data/Gemfile +11 -10
  6. data/README.md +29 -44
  7. data/app/controllers/spree/feedback_reviews_controller.rb +2 -8
  8. data/app/controllers/spree/reviews_controller.rb +1 -1
  9. data/app/decorators/models/solidus_reviews/spree/product_decorator.rb +6 -5
  10. data/app/helpers/spree/reviews_helper.rb +5 -5
  11. data/app/models/spree/feedback_review.rb +1 -1
  12. data/app/models/spree/review.rb +9 -8
  13. data/app/models/spree/reviews_ability.rb +2 -2
  14. data/app/views/spree/api/reviews/_feedback_review.json.jbuilder +1 -1
  15. data/app/views/spree/api/reviews/_review.json.jbuilder +1 -1
  16. data/db/migrate/20120123141326_recalculate_ratings.rb +1 -2
  17. data/db/migrate/20190613165528_add_verified_purchaser_to_reviews.rb +2 -0
  18. data/lib/controllers/spree/api/reviews_controller.rb +16 -14
  19. data/lib/generators/solidus_reviews/install/install_generator.rb +1 -1
  20. data/lib/solidus_reviews.rb +4 -2
  21. data/lib/{spree_reviews → solidus_reviews}/engine.rb +3 -3
  22. data/lib/solidus_reviews/version.rb +5 -0
  23. data/solidus_reviews.gemspec +14 -23
  24. data/spec/controllers/spree/admin/feedback_reviews_controller_spec.rb +1 -1
  25. data/spec/controllers/spree/admin/review_settings_controller_spec.rb +3 -4
  26. data/spec/controllers/spree/admin/reviews_controller_spec.rb +3 -3
  27. data/spec/controllers/spree/api/reviews_controller_spec.rb +27 -25
  28. data/spec/controllers/spree/feedback_reviews_controller_spec.rb +7 -7
  29. data/spec/controllers/spree/products_controller_spec.rb +1 -1
  30. data/spec/controllers/spree/reviews_controller_spec.rb +6 -7
  31. data/spec/features/admin_spec.rb +6 -6
  32. data/spec/features/reviews_spec.rb +32 -31
  33. data/spec/models/feedback_review_spec.rb +13 -13
  34. data/spec/models/product_spec.rb +13 -10
  35. data/spec/models/review_spec.rb +36 -40
  36. data/spec/models/reviews_ability_spec.rb +14 -14
  37. data/spec/models/reviews_configuration_spec.rb +9 -10
  38. data/spec/spec_helper.rb +4 -19
  39. data/spec/support/config.rb +7 -0
  40. data/spec/support/factories.rb +3 -0
  41. metadata +18 -180
  42. data/CONTRIBUTING.md +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fc709261f34b4979904d11cceeb17b22a57be36089f37f77dea475262506c24
4
- data.tar.gz: 9a3b6b6f70b0867534f634426da005d312db19e21d5633bb9e5ca2e8ab6ba3ec
3
+ metadata.gz: d08b28f0274d8513a1b171c01fb30e52ef1c692e7166e9680cb62d19731605b3
4
+ data.tar.gz: b091c19c062b9dd3cd98c9726b9aab52371817e901a87e15e812349b9ca1a032
5
5
  SHA512:
6
- metadata.gz: 8c4eaa7f6e301a830b196bd194c897a670a8c193607fe98542890625ed6a3d19b54c7ce8b8df9678ba45bc3db114b0a358c58d053a93be0e438b4fa6354939fe
7
- data.tar.gz: e2d8efba5a9ba5602318c40e1bcccb16291f49a68c577e76acf2db42b37e879bb9adfcbc56367b47dbfa84092964bdfe199e7aacb47b85c071c94d134c7906e4
6
+ metadata.gz: 6d3044e1fa6a0d03491cef8269730d25be40d1ad3e1ebcd32cf81ce71c8dc520a29d8bd8e6415bc738075c11478461cb4be0eb53007d6adb8e613970d835f5e8
7
+ data.tar.gz: a34b5ea8da48129b82c7063fa9806a635f3d92949fae6a0af0b98c58337480db6dc2e7cfe5f61e8cd1077834e14557ddc72d41127f8664b227fcc62b1fd0791a
data/.rubocop.yml CHANGED
@@ -1,322 +1,12 @@
1
- # Relaxed.Ruby.Style
1
+ inherit_from: .rubocop_todo.yml
2
2
 
3
- AllCops:
4
- Exclude:
5
- - 'vendor/**/*'
6
- - '**/vendor/**/*'
7
- - '*/spec/dummy/**/*'
8
- - 'sandbox/**/*'
9
- - '**/templates/**/*'
10
- TargetRubyVersion: 2.2
11
-
12
- # Sometimes I believe this reads better
13
- # This also causes spacing issues on multi-line fixes
14
- Style/BracesAroundHashParameters:
15
- Enabled: false
16
-
17
- # We use class vars and will have to continue doing so for compatability
18
- Style/ClassVars:
19
- Enabled: false
20
-
21
- # We need these names for backwards compatability
22
- Naming/PredicateName:
23
- Enabled: false
24
-
25
- Naming/AccessorMethodName:
26
- Enabled: false
27
-
28
- # This has been used for customization
29
- Style/MutableConstant:
30
- Enabled: false
31
-
32
- Style/ClassAndModuleChildren:
33
- Enabled: false
34
-
35
- Style/EmptyElse:
36
- Enabled: false
37
-
38
- Style/GuardClause:
39
- Enabled: false
40
-
41
- Style/Next:
42
- Enabled: false
43
-
44
- Style/NumericPredicate:
45
- Enabled: false
46
-
47
- Style/WordArray:
48
- Enabled: false
49
-
50
- Style/ConditionalAssignment:
51
- Enabled: false
52
-
53
- Performance/Count:
54
- Enabled: false
55
-
56
- Style/RaiseArgs:
57
- Enabled: false
58
-
59
- Naming/BinaryOperatorParameterName:
60
- Enabled: false
61
-
62
- # We can use good judgement here
63
- Style/RegexpLiteral:
64
- Enabled: false
65
-
66
- # Unicode comments are useful
67
- Style/AsciiComments:
68
- Enabled: false
69
-
70
- Layout/EndAlignment:
71
- Enabled: false
72
-
73
- Layout/ElseAlignment:
74
- Enabled: false
75
-
76
- Layout/IndentationWidth:
77
- Enabled: false
3
+ require:
4
+ - solidus_extension_dev_tools/rubocop
78
5
 
79
- Layout/AlignParameters:
80
- Enabled: false
6
+ inherit_gem:
7
+ solidus_extension_dev_tools: .rubocop.extension.yml
81
8
 
82
- Layout/ClosingParenthesisIndentation:
83
- Enabled: false
84
-
85
- Layout/MultilineMethodCallIndentation:
86
- Enabled: false
87
-
88
- Layout/IndentArray:
89
- Enabled: false
90
-
91
- Layout/IndentHash:
92
- Enabled: false
93
-
94
- Layout/AlignHash:
95
- Enabled: false
96
-
97
- Style/TrailingCommaInArguments:
98
- Enabled: false
99
-
100
- Style/TrailingCommaInArrayLiteral:
101
- Enabled: false
102
-
103
- Style/TrailingCommaInHashLiteral:
104
- Enabled: false
105
-
106
- # Symbol Arrays are ok and the %i syntax widely unknown
107
- Style/SymbolArray:
108
- Enabled: false
109
-
110
- Rails/DynamicFindBy:
111
- Whitelist:
112
- - find_by_param
113
- - find_by_param!
114
-
115
- # We use a lot of
116
- #
117
- # expect {
118
- # something
119
- # }.to { happen }
120
- #
121
- # syntax in the specs files.
122
- Lint/AmbiguousBlockAssociation:
123
- Exclude:
124
- - '*/spec/**/*'
125
- - 'spec/**/*' # For the benefit of apps that inherit from this config
126
-
127
- # We use eval to add common_spree_dependencies into the Gemfiles of each of our gems
128
- Security/Eval:
9
+ AllCops:
129
10
  Exclude:
130
- - 'Gemfile'
131
- - 'common_spree_dependencies.rb'
132
- - '*/Gemfile'
133
-
134
- Naming/VariableNumber:
135
- Enabled: false
136
-
137
- # Write empty methods as you wish.
138
- Style/EmptyMethod:
139
- Enabled: false
140
-
141
- # From http://relaxed.ruby.style/
142
-
143
- Style/Alias:
144
- Enabled: false
145
- StyleGuide: http://relaxed.ruby.style/#stylealias
146
-
147
- Style/BeginBlock:
148
- Enabled: false
149
- StyleGuide: http://relaxed.ruby.style/#stylebeginblock
150
-
151
- Style/BlockDelimiters:
152
- Enabled: false
153
- StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
154
-
155
- Style/Documentation:
156
- Enabled: false
157
- StyleGuide: http://relaxed.ruby.style/#styledocumentation
158
-
159
- Layout/DotPosition:
160
- Enabled: false
161
- StyleGuide: http://relaxed.ruby.style/#styledotposition
162
-
163
- Style/DoubleNegation:
164
- Enabled: false
165
- StyleGuide: http://relaxed.ruby.style/#styledoublenegation
166
-
167
- Style/EndBlock:
168
- Enabled: false
169
- StyleGuide: http://relaxed.ruby.style/#styleendblock
170
-
171
- Style/FormatString:
172
- Enabled: false
173
- StyleGuide: http://relaxed.ruby.style/#styleformatstring
174
-
175
- Style/IfUnlessModifier:
176
- Enabled: false
177
- StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
178
-
179
- Style/Lambda:
180
- Enabled: false
181
- StyleGuide: http://relaxed.ruby.style/#stylelambda
182
-
183
- Style/ModuleFunction:
184
- Enabled: false
185
- StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
186
-
187
- Style/MultilineBlockChain:
188
- Enabled: false
189
- StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
190
-
191
- Style/NegatedIf:
192
- Enabled: false
193
- StyleGuide: http://relaxed.ruby.style/#stylenegatedif
194
-
195
- Style/NegatedWhile:
196
- Enabled: false
197
- StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
198
-
199
- Style/ParallelAssignment:
200
- Enabled: false
201
- StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
202
-
203
- Style/PercentLiteralDelimiters:
204
- Enabled: false
205
- StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
206
-
207
- Style/PerlBackrefs:
208
- Enabled: false
209
- StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
210
-
211
- Style/Semicolon:
212
- Enabled: false
213
- StyleGuide: http://relaxed.ruby.style/#stylesemicolon
214
-
215
- Style/SignalException:
216
- Enabled: false
217
- StyleGuide: http://relaxed.ruby.style/#stylesignalexception
218
-
219
- Style/SingleLineBlockParams:
220
- Enabled: false
221
- StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
222
-
223
- Style/SingleLineMethods:
224
- Enabled: false
225
- StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
226
-
227
- Layout/SpaceBeforeBlockBraces:
228
- Enabled: false
229
- StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
230
-
231
- Layout/SpaceInsideParens:
232
- Enabled: false
233
- StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
234
-
235
- Style/SpecialGlobalVars:
236
- Enabled: false
237
- StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
238
-
239
- Style/StringLiterals:
240
- Enabled: false
241
- StyleGuide: http://relaxed.ruby.style/#stylestringliterals
242
-
243
- Style/SymbolProc:
244
- Enabled: false
245
-
246
- Style/TernaryParentheses:
247
- Enabled: false
248
-
249
- Style/WhileUntilModifier:
250
- Enabled: false
251
- StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
252
-
253
- Lint/AmbiguousRegexpLiteral:
254
- Enabled: false
255
- StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
256
-
257
- Lint/AssignmentInCondition:
258
- Enabled: false
259
- StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
260
-
261
- Metrics/AbcSize:
262
- Enabled: false
263
-
264
- Metrics/BlockNesting:
265
- Enabled: false
266
-
267
- Metrics/ClassLength:
268
- Enabled: false
269
-
270
- Metrics/ModuleLength:
271
- Enabled: false
272
-
273
- Metrics/BlockLength:
274
- Enabled: false
275
-
276
- Metrics/CyclomaticComplexity:
277
- Enabled: false
278
-
279
- Metrics/LineLength:
280
- Enabled: false
281
-
282
- Metrics/MethodLength:
283
- Enabled: false
284
-
285
- Metrics/ParameterLists:
286
- Enabled: false
287
-
288
- Metrics/PerceivedComplexity:
289
- Enabled: false
290
-
291
- Bundler/OrderedGems:
292
- Enabled: false
293
-
294
- Style/NumericLiterals:
295
- Enabled: false
296
-
297
- Style/FrozenStringLiteralComment:
298
- Enabled: true
299
- EnforcedStyle: always
300
-
301
- # json.() is idiomatic in jbuilder files
302
- Style/LambdaCall:
303
- Enabled: false
304
-
305
- Naming/UncommunicativeMethodParamName:
306
- AllowedNames:
307
- - id
308
- - to
309
- - _
310
-
311
- # Rubocop doesn't understand side-effects
312
- Style/IdenticalConditionalBranches:
313
- Enabled: false
314
-
315
- Naming/MemoizedInstanceVariableName:
316
- Enabled: false
317
-
318
- Lint/UselessComparison:
319
- Enabled: false
320
-
321
- Lint/HandleExceptions:
322
- Enabled: false
11
+ - spec/dummy/**/*
12
+ - vendor/**/*
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,221 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-11-27 10:11:04 +0100 using RuboCop version 0.76.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
12
+ Bundler/DuplicatedGem:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # Configuration parameters: Include.
18
+ # Include: **/*.gemspec,
19
+ Gemspec/RequiredRubyVersion:
20
+ Exclude:
21
+ - 'solidus_reviews.gemspec'
22
+
23
+ # Offense count: 1
24
+ Lint/AmbiguousOperator:
25
+ Exclude:
26
+ - 'lib/solidus_reviews/engine.rb'
27
+
28
+ # Offense count: 1
29
+ Lint/InterpolationCheck:
30
+ Exclude:
31
+ - 'spec/models/review_spec.rb'
32
+
33
+ # Offense count: 33
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
36
+ # URISchemes: http, https
37
+ Metrics/LineLength:
38
+ Max: 155
39
+
40
+ # Offense count: 1
41
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
42
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
43
+ Naming/MemoizedInstanceVariableName:
44
+ Exclude:
45
+ - 'app/controllers/spree/feedback_reviews_controller.rb'
46
+
47
+ # Offense count: 2
48
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
49
+ # AllowedNames: io, id, to, by, on, in, at, ip, db, os
50
+ Naming/UncommunicativeMethodParamName:
51
+ Exclude:
52
+ - 'app/helpers/spree/reviews_helper.rb'
53
+
54
+ # Offense count: 2
55
+ # Configuration parameters: EnforcedStyle.
56
+ # SupportedStyles: snake_case, normalcase, non_integer
57
+ Naming/VariableNumber:
58
+ Exclude:
59
+ - 'spec/models/review_spec.rb'
60
+
61
+ # Offense count: 2
62
+ RSpec/AnyInstance:
63
+ Exclude:
64
+ - 'spec/controllers/spree/admin/reviews_controller_spec.rb'
65
+ - 'spec/controllers/spree/reviews_controller_spec.rb'
66
+
67
+ # Offense count: 35
68
+ # Configuration parameters: Prefixes.
69
+ # Prefixes: when, with, without
70
+ RSpec/ContextWording:
71
+ Exclude:
72
+ - 'spec/controllers/spree/api/reviews_controller_spec.rb'
73
+ - 'spec/controllers/spree/reviews_controller_spec.rb'
74
+ - 'spec/features/admin_spec.rb'
75
+ - 'spec/features/reviews_spec.rb'
76
+ - 'spec/helpers/review_helper_spec.rb'
77
+ - 'spec/models/feedback_review_spec.rb'
78
+ - 'spec/models/product_spec.rb'
79
+ - 'spec/models/review_spec.rb'
80
+ - 'spec/models/reviews_ability_spec.rb'
81
+
82
+ # Offense count: 2
83
+ RSpec/DescribeClass:
84
+ Exclude:
85
+ - 'spec/features/admin_spec.rb'
86
+ - 'spec/features/reviews_spec.rb'
87
+
88
+ # Offense count: 6
89
+ # Configuration parameters: CustomTransform, IgnoreMethods.
90
+ RSpec/FilePath:
91
+ Exclude:
92
+ - 'spec/helpers/review_helper_spec.rb'
93
+ - 'spec/models/feedback_review_spec.rb'
94
+ - 'spec/models/product_spec.rb'
95
+ - 'spec/models/review_spec.rb'
96
+ - 'spec/models/reviews_ability_spec.rb'
97
+ - 'spec/models/reviews_configuration_spec.rb'
98
+
99
+ # Offense count: 1
100
+ # Configuration parameters: AssignmentOnly.
101
+ RSpec/InstanceVariable:
102
+ Exclude:
103
+ - 'spec/controllers/spree/reviews_controller_spec.rb'
104
+
105
+ # Offense count: 6
106
+ RSpec/LetSetup:
107
+ Exclude:
108
+ - 'spec/controllers/spree/admin/feedback_reviews_controller_spec.rb'
109
+ - 'spec/models/product_spec.rb'
110
+
111
+ # Offense count: 3
112
+ # Configuration parameters: .
113
+ # SupportedStyles: have_received, receive
114
+ RSpec/MessageSpies:
115
+ EnforcedStyle: receive
116
+
117
+ # Offense count: 51
118
+ # Configuration parameters: AggregateFailuresByDefault.
119
+ RSpec/MultipleExpectations:
120
+ Max: 8
121
+
122
+ # Offense count: 71
123
+ # Configuration parameters: IgnoreSharedExamples.
124
+ RSpec/NamedSubject:
125
+ Exclude:
126
+ - 'spec/controllers/spree/api/reviews_controller_spec.rb'
127
+ - 'spec/models/reviews_configuration_spec.rb'
128
+
129
+ # Offense count: 8
130
+ RSpec/NestedGroups:
131
+ Max: 4
132
+
133
+ # Offense count: 1
134
+ RSpec/UnspecifiedException:
135
+ Exclude:
136
+ - 'spec/controllers/spree/feedback_reviews_controller_spec.rb'
137
+
138
+ # Offense count: 2
139
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
140
+ RSpec/VerifiedDoubles:
141
+ Exclude:
142
+ - 'spec/models/reviews_ability_spec.rb'
143
+
144
+ # Offense count: 1
145
+ # Configuration parameters: Include.
146
+ # Include: app/models/**/*.rb
147
+ Rails/HasManyOrHasOneDependent:
148
+ Exclude:
149
+ - 'app/models/spree/review.rb'
150
+
151
+ # Offense count: 1
152
+ # Configuration parameters: Include.
153
+ # Include: app/models/**/*.rb
154
+ Rails/InverseOf:
155
+ Exclude:
156
+ - 'app/models/spree/review.rb'
157
+
158
+ # Offense count: 1
159
+ # Configuration parameters: Include.
160
+ # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
161
+ Rails/Output:
162
+ Exclude:
163
+ - 'lib/generators/solidus_reviews/install/install_generator.rb'
164
+
165
+ # Offense count: 1
166
+ # Configuration parameters: Include.
167
+ # Include: **/Rakefile, **/*.rake
168
+ Rails/RakeEnvironment:
169
+ Exclude:
170
+ - 'Rakefile'
171
+
172
+ # Offense count: 2
173
+ Rails/ReflectionClassName:
174
+ Exclude:
175
+ - 'app/models/spree/feedback_review.rb'
176
+ - 'app/models/spree/review.rb'
177
+
178
+ # Offense count: 5
179
+ # Configuration parameters: Blacklist, Whitelist.
180
+ # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
181
+ Rails/SkipsModelValidations:
182
+ Exclude:
183
+ - 'app/controllers/spree/admin/reviews_controller.rb'
184
+ - 'db/migrate/20120123141326_recalculate_ratings.rb'
185
+ - 'spec/controllers/spree/admin/reviews_controller_spec.rb'
186
+ - 'spec/models/product_spec.rb'
187
+
188
+ # Offense count: 10
189
+ # Cop supports --auto-correct.
190
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
191
+ # SupportedStyles: nested, compact
192
+ Style/ClassAndModuleChildren:
193
+ Exclude:
194
+ - 'app/controllers/spree/admin/feedback_reviews_controller.rb'
195
+ - 'app/controllers/spree/admin/review_settings_controller.rb'
196
+ - 'app/controllers/spree/admin/reviews_controller.rb'
197
+ - 'app/controllers/spree/feedback_reviews_controller.rb'
198
+ - 'app/controllers/spree/reviews_controller.rb'
199
+ - 'app/helpers/spree/reviews_helper.rb'
200
+ - 'app/models/spree/feedback_review.rb'
201
+ - 'app/models/spree/review.rb'
202
+ - 'app/models/spree/reviews_ability.rb'
203
+ - 'app/models/spree/reviews_configuration.rb'
204
+
205
+ # Offense count: 2
206
+ Style/ClassVars:
207
+ Exclude:
208
+ - 'app/decorators/helpers/solidus_reviews/spree/api/api_helpers_decorator.rb'
209
+
210
+ # Offense count: 1
211
+ # Configuration parameters: .
212
+ # SupportedStyles: annotated, template, unannotated
213
+ Style/FormatStringToken:
214
+ EnforcedStyle: unannotated
215
+
216
+ # Offense count: 3
217
+ # Configuration parameters: MinBodyLength.
218
+ Style/GuardClause:
219
+ Exclude:
220
+ - 'app/controllers/spree/admin/reviews_controller.rb'
221
+ - 'lib/controllers/spree/api/reviews_controller.rb'