active_interaction 1.2.3 → 1.2.4

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: 6ba88eafd8b605090eafd610e1b9b4e41638e5b8
4
- data.tar.gz: 44de977111bd36c6348864c0024ff886d71022c5
3
+ metadata.gz: 8eae8e946fb9ec93d0abfa2e2264a7a35b9e8d56
4
+ data.tar.gz: 7c976feedfef904516036479d67a789f147d8e4a
5
5
  SHA512:
6
- metadata.gz: 1befd803a782dfe60b5c058f49b3e670e2f4b8d4d5434b15e81acdb7564ab803812dcce8172c615fe0bc04f7a8be7576615f02b9183d8d3a9c8776f77f2c6a92
7
- data.tar.gz: ced6bb16015b351c6d4555feb91d84f82ed4e62f3cb9ca650c9ac7c3be9d2f7edcf29f94a84aef6e24fe58572b41de52565bf4c436d3db534e48758cfc39f286
6
+ metadata.gz: 79162f4100cf2618ec44bddee98714af4d0b5b01d13cc8188f57a847031ece8c1657223d098912bdaa4b3ba89996cc233955d57cbd9ed44f5910cf44afb03164
7
+ data.tar.gz: 30f668bd7172e2f5d45df36b38d4ecda7b00d0d5aa1ca1667c4b7fa13eb21c810d8260cd269763debc738614828a0314a941cbb6ad69b86950ac53e3ec3f008c
data/CHANGELOG.md CHANGED
@@ -1,216 +1,335 @@
1
1
  # [Master][]
2
2
 
3
+ # [1.2.4][] (2014-08-07)
4
+
5
+ ## Fixed
6
+
7
+ - [#203][]: Fix a bug that prevented transaction options from being passed to
8
+ subclasses.
9
+
3
10
  # [1.2.3][] (2014-05-12)
4
11
 
5
- - Fix a bug that raised `ActiveRecord::Rollback` when composing even when not
6
- in a transaction.
12
+ ## Fixed
13
+
14
+ - [#192][]: Fix a bug that raised `ActiveRecord::Rollback` when composing even
15
+ when not in a transaction.
7
16
 
8
17
  # [1.2.2][] (2014-05-07)
9
18
 
19
+ ## Fixed
20
+
10
21
  - Fix a bug that raised `NameError`s when there were invalid nested hash
11
22
  errors.
12
23
  - Add missing translation for symbol filters.
13
24
 
14
25
  # [1.2.1][] (2014-05-02)
15
26
 
16
- - Fix a bug that marked model inputs as invalid even if they returned true for
17
- `object.is_a?(klass)`.
27
+ ## Fixed
28
+
29
+ - [#179][]: Fix a bug that marked model inputs as invalid even if they returned true
30
+ for `object.is_a?(klass)`.
18
31
 
19
32
  # [1.2.0][] (2014-04-30)
20
33
 
21
- - Add support for Rails-style date and time parameters like `date(1i)`.
22
- - Add a decimal filter.
23
- - Add support for disabling and modifying transactions through the
34
+ ## Added
35
+
36
+ - [#175][]: Add support for Rails-style date and time parameters like `date(1i)`.
37
+ - [#173][]: Add a decimal filter.
38
+ - [#155][]: Add support for disabling and modifying transactions through the
24
39
  `transaction` helper method.
25
- - Add support for `column_for_attribute` which provides better interoperability with gems like Formtastic and Simple Form.
40
+ - [#140][]: Add support for `column_for_attribute` which provides better
41
+ interoperability with gems like Formtastic and Simple Form.
26
42
 
27
43
  # [1.1.7][] (2014-04-30)
28
44
 
29
- - Fix a bug that leaked validators among all child classes.
45
+ ## Fixed
46
+
47
+ - [#174][]: Fix a bug that leaked validators among all child classes.
30
48
 
31
49
  # [1.1.6][] (2014-04-29)
32
50
 
33
- - Fix a bug that caused nested hash error messages to be misleading.
51
+ ## Fixed
52
+
53
+ - [#36][]: Fix a bug that caused nested hash error messages to be misleading.
34
54
 
35
55
  # [1.1.5][] (2014-03-31)
36
56
 
37
- - The `transform_keys` method broke backwards compatibility because it's not available until Rails 4.0.2.
57
+ ## Fixed
58
+
59
+ - The `transform_keys` method broke backwards compatibility because it's not
60
+ available until Rails 4.0.2.
38
61
 
39
62
  # [1.1.4][] (2014-03-31)
40
63
 
64
+ ## Fixed
65
+
41
66
  - Fix an issue where non-stripped hash keys would be incorrectly converted to strings.
42
67
 
43
68
  # [1.1.3][] (2014-03-31)
44
69
 
45
- - Fix Rubocop errors and pin the version to avoid future issues with new cops
70
+ ## Fixed
71
+
72
+ - [#165][]: Fix Rubocop errors and pin the version to avoid future issues with new cops
46
73
  breaking the build.
47
- - Fix some denial of service attacks via hash symbolization. (See [#163][] for details)
74
+
75
+ ## Security
76
+
77
+ - [#163][]: Fix some denial of service attacks via hash symbolization.
48
78
 
49
79
  # [1.1.2][] (2014-03-05)
50
80
 
51
- - Don't constantize classes for model filters on initialization. This fixes a
81
+ ## Fixed
82
+
83
+ - [#156][]: Don't constantize classes for model filters on initialization. This fixes a
52
84
  bug that made those filters dependent on load order.
53
85
 
54
86
  # [1.1.1][] (2014-03-04)
55
87
 
56
- - Allow merging ActiveModel errors into ActiveInteraction errors with
88
+ ## Fixed
89
+
90
+ - [#153][]: Allow merging ActiveModel errors into ActiveInteraction errors with
57
91
  `ActiveInteraction::Errors#merge!`.
58
92
 
59
93
  # [1.1.0][] (2014-02-28)
60
94
 
61
- - Only set instance variables for attributes with readers defined.
62
- - Support `:only` and `:except` options simultaneously with `import_filters`.
95
+ ## Added
96
+
97
+ - [#116][], [#119][], [#122][]: Speed up many filters by caching class constants.
98
+ - [#115][]: Add support for callbacks around `execute`.
99
+ - [#136][]: Allow callable defaults.
100
+
101
+ ## Changed
102
+
103
+ - [#114][]: Support `:only` and `:except` options simultaneously with `import_filters`.
63
104
  Previously this raised an `ArgumentError`.
64
- - Support passing a single symbol to `:only` and `:except`. Previously an Array
105
+ - [#114][]: Support passing a single symbol to `:only` and `:except`. Previously an Array
65
106
  was required.
66
- - Speed up many filters by caching class constants.
67
- - Add support for callbacks around `execute`.
68
- - Allow callable defaults.
107
+
108
+ ## Security
109
+
110
+ - [#138][]: Only set instance variables for attributes with readers defined.
111
+
69
112
 
70
113
  # [1.0.5][] (2014-02-25)
71
114
 
72
- - Rollback database changes when `compose` fails.
115
+ ## Fixed
116
+
117
+ - [#143][]: Rollback database changes when `compose` fails.
73
118
 
74
119
  # [1.0.4][] (2014-02-11)
75
120
 
121
+ ## Fixed
122
+
76
123
  - Add translations to the gem specification.
77
124
 
78
125
  # ~~[1.0.3][] (2014-02-11)~~
79
126
 
80
- - Fix a bug that caused invalid strings to be parsed as `nil` instead of
127
+ ## Fixed
128
+
129
+ - [#135][]: Fix a bug that caused invalid strings to be parsed as `nil` instead of
81
130
  raising an error when `Time.zone` was set.
82
- - Fix bug that prevented loading I18n translations.
131
+ - [#134][]: Fix bug that prevented loading I18n translations.
83
132
 
84
133
  # [1.0.2][] (2014-02-07)
85
134
 
86
- - Stop creating duplicate errors on subsequent calls to `valid?`.
135
+ ## Fixed
136
+
137
+ - [#130][]: Stop creating duplicate errors on subsequent calls to `valid?`.
87
138
 
88
139
  # [1.0.1][] (2014-02-04)
89
140
 
90
- - Short circuit `valid?` after successfully running an interaction.
91
- - Fix a bug that prevented merging interpolated symbolic errors.
92
- - Use `:invalid_type` instead of `:invalid` as I18n key for type errors.
93
- - Fix a bug that skipped setting up accessors for imported filters.
141
+ ## Fixed
142
+
143
+ - [#125][]: Short circuit `valid?` after successfully running an interaction.
144
+ - [#129][]: Fix a bug that prevented merging interpolated symbolic errors.
145
+ - [#128][]: Use `:invalid_type` instead of `:invalid` as I18n key for type errors.
146
+ - [#127][]: Fix a bug that skipped setting up accessors for imported filters.
94
147
 
95
148
  # [1.0.0][] (2014-01-21)
96
149
 
97
- - **Replace `Filters` with a hash.** To iterate over `Filter` objects, use
150
+ ## Added
151
+
152
+ - [#102][]: Add predicate methods for checking if an input was passed.
153
+ - [#103][]: Allow fetching filters by name.
154
+ - [#104][]: Allow import filters from another interaction with `import_filters`.
155
+
156
+ ## Changed
157
+
158
+ - [#111][]: Replace `Filters` with a hash. To iterate over `Filter` objects, use
98
159
  `Interaction.filters.values`.
99
160
  - Rename `Filter#has_default?` to `Filter#default?`.
100
- - Add `respond_to_missing?` to complement `method_missing` calls.
101
- - Add predicate methods for checking if an input was passed.
102
- - When adding a filter that shares a name with an existing filter, it will now
161
+
162
+ ## Fixed
163
+
164
+ - [#98][]: Add `respond_to_missing?` to complement `method_missing` calls.
165
+ - [#106][]: When adding a filter that shares a name with an existing filter, it will now
103
166
  replace the existing one instead of adding a duplicate.
104
- - Allow fetching filters by name.
105
- - Allow import filters from another interaction with `import_filters`.
106
167
 
107
168
  # [0.10.2][] (2014-01-02)
108
169
 
109
- - Fix a bug that marked Time instances as invalid if Time.zone was set.
170
+ ## Fixed
171
+
172
+ - [#94][]: Fix a bug that marked Time instances as invalid if Time.zone was set.
110
173
 
111
174
  # [0.10.1][] (2013-12-20)
112
175
 
113
- - Fix bug that prevented parsing strings as times when ActiveSupport was
176
+ ## Fixed
177
+
178
+ - [#90][]: Fix bug that prevented parsing strings as times when ActiveSupport was
114
179
  available.
115
180
 
116
181
  # [0.10.0][] (2013-12-19)
117
182
 
183
+ ## Added
184
+
118
185
  - Support casting "true" and "false" as booleans.
119
- - Fix bug that allowed subclasses to mutate the filters on their superclasses.
186
+
187
+ ## Fixed
188
+
189
+ - [#89][]: Fix bug that allowed subclasses to mutate the filters on their superclasses.
120
190
 
121
191
  # [0.9.1][] (2013-12-17)
122
192
 
123
- - Fix I18n deprecation warning.
124
- - Raise `ArgumentError` when running an interaction with non-hash inputs.
125
- - For compatibility with `ActiveRecord::Errors`, support indifferent access of
193
+ ## Fixed
194
+
195
+ - [#84][]: Fix I18n deprecation warning.
196
+ - [#82][]: Raise `ArgumentError` when running an interaction with non-hash inputs.
197
+ - [#77][]: For compatibility with `ActiveRecord::Errors`, support indifferent access of
126
198
  `ActiveInteraction::Errors`.
127
- - Fix losing filters when using inheritance.
199
+ - [#88][]: Fix losing filters when using inheritance.
128
200
 
129
201
  # [0.9.0][] (2013-12-02)
130
202
 
131
- - Add experimental composition implementation
132
- (`ActiveInteraction::Base#compose`).
203
+ ## Added
204
+
205
+ - Add experimental composition implementation (`ActiveInteraction::Base#compose`).
206
+
207
+ ## Removed
208
+
133
209
  - Remove `ActiveInteraction::Pipeline`.
134
210
 
135
211
  # [0.8.0][] (2013-11-14)
136
212
 
137
- - Add ability to document interactions and filters.
213
+ ## Added
214
+
215
+ - [#44][], [#45][]: Add ability to document interactions and filters.
138
216
 
139
217
  # [0.7.0][] (2013-11-14)
140
218
 
141
- - Add ability to chain a series of interactions together with
219
+ ## Added
220
+
221
+ - [#41][]: Add ability to chain a series of interactions together with
142
222
  `ActiveInteraction::Pipeline`.
143
223
 
144
224
  # [0.6.1][] (2013-11-14)
145
225
 
226
+ ## Fixed
227
+
146
228
  - Re-release. Forgot to merge into master.
147
229
 
148
230
  # ~~[0.6.0][] (2013-11-14)~~
149
231
 
150
- - **Error class now end with `Error`.**
151
- - **By default, strip unlisted keys from hashes. To retain the old behavior,
152
- set `strip: false` on a hash filter.**
153
- - **Prevent specifying defaults (other than `nil` or `{}`) on hash filters. Set
154
- defaults on the nested filters instead.**
232
+ ## Added
233
+
155
234
  - Add ability to introspect interactions with `filters`.
156
- - Fix bug that prevented listing multiple attributes in a hash filter.
157
- - Allow getting all of the user-supplied inputs in an interaction with
235
+ - [#57][]: Allow getting all of the user-supplied inputs in an interaction with
158
236
  `inputs`.
159
- - Fix bug that prevented hash filters from being nested in array filters.
160
- - Replace `allow_nil: true` with `default: nil`.
161
- - Add a symbol filter.
162
- - Allow adding symbolic errors with `errors.add_sym` and retrieving them with
237
+ - [#61][]: Add a symbol filter.
238
+ - [#58][]: Allow adding symbolic errors with `errors.add_sym` and retrieving them with
163
239
  `errors.symbolic`.
164
240
 
241
+ ## Changed
242
+
243
+ - Error class now end with `Error`.
244
+ - By default, strip unlisted keys from hashes. To retain the old behavior,
245
+ set `strip: false` on a hash filter.
246
+ - [#49][]: Prevent specifying defaults (other than `nil` or `{}`) on hash filters. Set
247
+ defaults on the nested filters instead.
248
+ - [#66][]: Replace `allow_nil: true` with `default: nil`.
249
+
250
+ ## Fixed
251
+
252
+ - Fix bug that prevented listing multiple attributes in a hash filter.
253
+ - Fix bug that prevented hash filters from being nested in array filters.
254
+
165
255
  # [0.5.0][] (2013-10-16)
166
256
 
167
- - Allow adding errors in `execute` method with `errors.add`.
168
- - Prevent manually setting the outcome's result.
257
+ ## Added
258
+
259
+ - [#34][]: Allow adding errors in `execute` method with `errors.add`.
260
+
261
+ ## Fixed
262
+
263
+ - [#56][]: Prevent manually setting the outcome's result.
169
264
 
170
265
  # [0.4.0][] (2013-08-15)
171
266
 
267
+ ## Added
268
+
172
269
  - Support i18n translations.
173
270
 
174
271
  # [0.3.0][] (2013-08-07)
175
272
 
176
- - Give better error messages for nested attributes.
177
- - Use default value when given an explicit `nil`.
178
- - Allow nested default values.
273
+ ## Added
274
+
275
+ - [#30][]: Allow nested default values.
276
+
277
+ ## Changed
278
+
279
+ - [#36][]: Give better error messages for nested attributes.
280
+ - [#39][]: Add a more useful invalid interaction error message.
281
+ - [#38][]: Use default value when given an explicit `nil`.
179
282
 
180
283
  # [0.2.2][] (2013-08-07)
181
284
 
182
- - Fix support for `ActiveSupport::TimeWithZone`.
285
+ ## Fixed
286
+
287
+ - [#40][]: Fix support for `ActiveSupport::TimeWithZone`.
183
288
 
184
289
  # [0.2.1][] (2013-08-06)
185
290
 
186
- - Fix setting a default value on more than one attribute at a time.
291
+ ## Fixed
292
+
293
+ - [#37][]: Fix setting a default value on more than one attribute at a time.
187
294
 
188
295
  # [0.2.0][] (2013-07-16)
189
296
 
190
- - Wrap interactions in ActiveRecord transactions if they're available.
191
- - Add option to strip string values, which is enabled by default.
192
- - Add support for strptime format strings on Date, DateTime, and Time filters.
297
+ ## Added
298
+
299
+ - [#23][]: Add support for strptime format strings on Date, DateTime, and Time filters.
300
+
301
+ ## Changed
302
+
303
+ - [#20][]: Wrap interactions in ActiveRecord transactions if they're available.
304
+ - [#24][]: Add option to strip string values, which is enabled by default.
193
305
 
194
306
  # [0.1.3][] (2013-07-16)
195
307
 
308
+ ## Fixed
309
+
196
310
  - Fix bug that prevented `attr_accessor`s from working.
197
311
  - Handle unconfigured timezones.
198
- - Use RDoc as YARD's Markdown provider instead of kramdown.
312
+ - [#27][]: Use RDoc as YARD's Markdown provider instead of kramdown.
199
313
 
200
314
  # [0.1.2][] (2013-07-14)
201
315
 
202
- - `execute` will now have the filtered version of the values passed
316
+ ## Fixed
317
+
318
+ - [#29][]: `execute` will now have the filtered version of the values passed
203
319
  to `run` or `run!` as was intended.
204
320
 
205
321
  # [0.1.1][] (2013-07-13)
206
322
 
207
- - Correct gemspec dependencies on activemodel.
323
+ ## Fixed
324
+
325
+ - [#28][]: Correct gemspec dependencies on activemodel.
208
326
 
209
327
  # ~~[0.1.0][] (2013-07-12)~~
210
328
 
211
329
  - Initial release.
212
330
 
213
- [master]: https://github.com/orgsync/active_interaction/compare/v1.2.3...master
331
+ [master]: https://github.com/orgsync/active_interaction/compare/v1.2.4...master
332
+ [1.2.4]: https://github.com/orgsync/active_interaction/compare/v1.2.3...v1.2.4
214
333
  [1.2.3]: https://github.com/orgsync/active_interaction/compare/v1.2.2...v1.2.3
215
334
  [1.2.2]: https://github.com/orgsync/active_interaction/compare/v1.2.1...v1.2.2
216
335
  [1.2.1]: https://github.com/orgsync/active_interaction/compare/v1.2.0...v1.2.1
@@ -249,4 +368,65 @@
249
368
  [0.1.1]: https://github.com/orgsync/active_interaction/compare/v0.1.0...v0.1.1
250
369
  [0.1.0]: https://github.com/orgsync/active_interaction/compare/62f999b...v0.1.0
251
370
 
252
- [#163]: https://github.com/orgsync/active_interaction/pull/163
371
+ [#20]: https://github.com/orgsync/active_interaction/issues/20
372
+ [#23]: https://github.com/orgsync/active_interaction/issues/23
373
+ [#24]: https://github.com/orgsync/active_interaction/issues/24
374
+ [#27]: https://github.com/orgsync/active_interaction/issues/27
375
+ [#28]: https://github.com/orgsync/active_interaction/issues/28
376
+ [#29]: https://github.com/orgsync/active_interaction/issues/29
377
+ [#30]: https://github.com/orgsync/active_interaction/issues/30
378
+ [#34]: https://github.com/orgsync/active_interaction/issues/34
379
+ [#36]: https://github.com/orgsync/active_interaction/issues/36
380
+ [#37]: https://github.com/orgsync/active_interaction/issues/37
381
+ [#38]: https://github.com/orgsync/active_interaction/issues/38
382
+ [#39]: https://github.com/orgsync/active_interaction/issues/39
383
+ [#40]: https://github.com/orgsync/active_interaction/issues/40
384
+ [#41]: https://github.com/orgsync/active_interaction/issues/41
385
+ [#44]: https://github.com/orgsync/active_interaction/issues/44
386
+ [#45]: https://github.com/orgsync/active_interaction/issues/45
387
+ [#49]: https://github.com/orgsync/active_interaction/issues/49
388
+ [#56]: https://github.com/orgsync/active_interaction/issues/56
389
+ [#57]: https://github.com/orgsync/active_interaction/issues/57
390
+ [#58]: https://github.com/orgsync/active_interaction/issues/58
391
+ [#61]: https://github.com/orgsync/active_interaction/issues/61
392
+ [#66]: https://github.com/orgsync/active_interaction/issues/66
393
+ [#77]: https://github.com/orgsync/active_interaction/issues/77
394
+ [#82]: https://github.com/orgsync/active_interaction/issues/82
395
+ [#84]: https://github.com/orgsync/active_interaction/issues/84
396
+ [#88]: https://github.com/orgsync/active_interaction/issues/88
397
+ [#89]: https://github.com/orgsync/active_interaction/issues/89
398
+ [#90]: https://github.com/orgsync/active_interaction/issues/90
399
+ [#94]: https://github.com/orgsync/active_interaction/issues/94
400
+ [#98]: https://github.com/orgsync/active_interaction/issues/98
401
+ [#102]: https://github.com/orgsync/active_interaction/issues/102
402
+ [#103]: https://github.com/orgsync/active_interaction/issues/103
403
+ [#104]: https://github.com/orgsync/active_interaction/issues/104
404
+ [#106]: https://github.com/orgsync/active_interaction/issues/106
405
+ [#111]: https://github.com/orgsync/active_interaction/issues/111
406
+ [#114]: https://github.com/orgsync/active_interaction/issues/114
407
+ [#115]: https://github.com/orgsync/active_interaction/issues/115
408
+ [#116]: https://github.com/orgsync/active_interaction/issues/116
409
+ [#119]: https://github.com/orgsync/active_interaction/issues/119
410
+ [#122]: https://github.com/orgsync/active_interaction/issues/122
411
+ [#125]: https://github.com/orgsync/active_interaction/issues/125
412
+ [#127]: https://github.com/orgsync/active_interaction/issues/127
413
+ [#128]: https://github.com/orgsync/active_interaction/issues/128
414
+ [#129]: https://github.com/orgsync/active_interaction/issues/129
415
+ [#130]: https://github.com/orgsync/active_interaction/issues/130
416
+ [#134]: https://github.com/orgsync/active_interaction/issues/134
417
+ [#135]: https://github.com/orgsync/active_interaction/issues/135
418
+ [#136]: https://github.com/orgsync/active_interaction/issues/136
419
+ [#138]: https://github.com/orgsync/active_interaction/issues/138
420
+ [#140]: https://github.com/orgsync/active_interaction/issues/140
421
+ [#143]: https://github.com/orgsync/active_interaction/issues/143
422
+ [#153]: https://github.com/orgsync/active_interaction/issues/153
423
+ [#155]: https://github.com/orgsync/active_interaction/issues/155
424
+ [#156]: https://github.com/orgsync/active_interaction/issues/156
425
+ [#163]: https://github.com/orgsync/active_interaction/issues/163
426
+ [#165]: https://github.com/orgsync/active_interaction/issues/165
427
+ [#173]: https://github.com/orgsync/active_interaction/issues/173
428
+ [#174]: https://github.com/orgsync/active_interaction/issues/174
429
+ [#175]: https://github.com/orgsync/active_interaction/issues/175
430
+ [#179]: https://github.com/orgsync/active_interaction/issues/179
431
+ [#192]: https://github.com/orgsync/active_interaction/issues/192
432
+ [#203]: https://github.com/orgsync/active_interaction/issues/203
data/README.md CHANGED
@@ -282,12 +282,12 @@ work done in [Mutations][17].
282
282
 
283
283
  [0]: https://github.com/orgsync/active_interaction
284
284
  [1]: https://badge.fury.io/rb/active_interaction.svg
285
- [2]: https://badge.fury.io/rb/active_interaction "Gem Version"
285
+ [2]: http://rubygems.org/gems/active_interaction "Gem Version"
286
286
  [3]: https://travis-ci.org/orgsync/active_interaction.svg?branch=master
287
287
  [4]: https://travis-ci.org/orgsync/active_interaction "Build Status"
288
- [5]: https://coveralls.io/repos/orgsync/active_interaction/badge.png?branch=master
288
+ [5]: https://img.shields.io/coveralls/orgsync/active_interaction/master.svg
289
289
  [6]: https://coveralls.io/r/orgsync/active_interaction?branch=master "Coverage Status"
290
- [7]: https://codeclimate.com/github/orgsync/active_interaction.png
290
+ [7]: https://codeclimate.com/github/orgsync/active_interaction/badges/gpa.svg
291
291
  [8]: https://codeclimate.com/github/orgsync/active_interaction "Code Climate"
292
292
  [9]: https://gemnasium.com/orgsync/active_interaction.svg
293
293
  [10]: https://gemnasium.com/orgsync/active_interaction "Dependency Status"
@@ -50,5 +50,5 @@ I18n.default_locale = :en
50
50
  #
51
51
  # @since 1.0.0
52
52
  #
53
- # @version 1.2.3
53
+ # @version 1.2.4
54
54
  module ActiveInteraction end
@@ -13,11 +13,16 @@ module ActiveInteraction
13
13
  send("#{name}=", value)
14
14
  end unless method_defined?(:[]=)
15
15
  end
16
+
17
+ class Errors
18
+ # Required for Rails < 3.2.13.
19
+ protected :initialize_dup
20
+ end
16
21
  end
17
22
 
18
23
  # @private
19
24
  class Hash
20
- # Required for Rails <= 4.0.2.
25
+ # Required for Rails < 4.0.0.
21
26
  def transform_keys
22
27
  result = {}
23
28
  each_key do |key|
@@ -39,6 +39,13 @@ module ActiveInteraction
39
39
  end
40
40
 
41
41
  module ClassMethods # rubocop:disable Documentation
42
+ # @param klass [Class]
43
+ def inherited(klass)
44
+ klass.transaction(transaction?, transaction_options.dup)
45
+
46
+ super
47
+ end
48
+
42
49
  # @param enable [Boolean]
43
50
  # @param options [Hash]
44
51
  #
@@ -171,9 +171,9 @@ module ActiveInteraction
171
171
  def merge_symbolic!(other)
172
172
  other.symbolic.each do |attribute, symbols|
173
173
  symbols.each do |symbol|
174
- unless symbolic[attribute].include?(symbol)
175
- symbolic[attribute] += [symbol]
176
- end
174
+ next if symbolic[attribute].include?(symbol)
175
+
176
+ symbolic[attribute] += [symbol]
177
177
  end
178
178
  end
179
179
  end
@@ -12,7 +12,7 @@ module ActiveInteraction
12
12
 
13
13
  # @return [Class]
14
14
  def klass
15
- @klass ||= self.class.slug.to_s.camelize.constantize
15
+ @klass ||= Object.const_get(self.class.slug.to_s.camelize, false)
16
16
  end
17
17
  end
18
18
  end
@@ -64,9 +64,11 @@ module ActiveInteraction
64
64
  fail InvalidFilterError, 'attribute names in array block'
65
65
  end
66
66
 
67
+ # rubocop:disable GuardClause
67
68
  if filter.default?
68
69
  fail InvalidDefaultError, 'default values in array block'
69
70
  end
71
+ # rubocop:enable GuardClause
70
72
  end
71
73
  end
72
74
  end
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'bigdecimal'
4
+
3
5
  module ActiveInteraction
4
6
  class Base
5
7
  # @!method self.decimal(*attributes, options = {})
@@ -46,7 +48,7 @@ module ActiveInteraction
46
48
  Float(value)
47
49
  BigDecimal.new(value, digits)
48
50
  rescue ArgumentError
49
- raise InvalidValueError, "Given value: #{value.inspect}"
51
+ raise InvalidValueError, "Given value: #{value.inspect}"
50
52
  end
51
53
 
52
54
  def klass
@@ -40,7 +40,7 @@ module ActiveInteraction
40
40
  # @raise [InvalidClassError]
41
41
  def klass
42
42
  klass_name = options.fetch(:class, name).to_s.classify
43
- klass_name.constantize
43
+ Object.const_get(klass_name)
44
44
  rescue NameError
45
45
  raise InvalidClassError, klass_name.inspect
46
46
  end
@@ -5,5 +5,5 @@ module ActiveInteraction
5
5
  # The version number.
6
6
  #
7
7
  # @return [Gem::Version]
8
- VERSION = Gem::Version.new('1.2.3')
8
+ VERSION = Gem::Version.new('1.2.4')
9
9
  end
@@ -439,12 +439,12 @@ describe ActiveInteraction::Base do
439
439
  let(:described_class) { InteractionWithFilter }
440
440
 
441
441
  it 'responds to the predicate' do
442
- expect(interaction.respond_to?(:thing?)).to be_true
442
+ expect(interaction.respond_to?(:thing?)).to be_truthy
443
443
  end
444
444
 
445
445
  context 'without a value' do
446
446
  it 'returns false' do
447
- expect(interaction.thing?).to be_false
447
+ expect(interaction.thing?).to be_falsey
448
448
  end
449
449
  end
450
450
 
@@ -456,16 +456,14 @@ describe ActiveInteraction::Base do
456
456
  end
457
457
 
458
458
  it 'returns true' do
459
- expect(interaction.thing?).to be_true
459
+ expect(interaction.thing?).to be_truthy
460
460
  end
461
461
  end
462
462
  end
463
463
 
464
464
  describe '.import_filters' do
465
- shared_context 'import_filters context' do
465
+ shared_context 'import_filters context' do |only, except|
466
466
  let(:klass) { AddInteraction }
467
- let(:only) { nil }
468
- let(:except) { nil }
469
467
 
470
468
  let(:described_class) do
471
469
  interaction = klass
@@ -477,8 +475,8 @@ describe ActiveInteraction::Base do
477
475
  end
478
476
  end
479
477
 
480
- shared_examples 'import_filters examples' do
481
- include_context 'import_filters context'
478
+ shared_examples 'import_filters examples' do |only, except|
479
+ include_context 'import_filters context', only, except
482
480
 
483
481
  it 'imports the filters' do
484
482
  expect(described_class.filters).to eql klass.filters
@@ -504,42 +502,31 @@ describe ActiveInteraction::Base do
504
502
  end
505
503
 
506
504
  context 'with neither :only nor :except' do
507
- include_examples 'import_filters examples'
505
+ include_examples 'import_filters examples', nil, nil
508
506
  end
509
507
 
510
508
  context 'with :only' do
511
509
  context 'as an Array' do
512
- include_examples 'import_filters examples'
513
-
514
- let(:only) { [:x] }
510
+ include_examples 'import_filters examples', [:x], nil
515
511
  end
516
512
 
517
513
  context 'as an Symbol' do
518
- include_examples 'import_filters examples'
519
-
520
- let(:only) { :x }
514
+ include_examples 'import_filters examples', :x, nil
521
515
  end
522
516
  end
523
517
 
524
518
  context 'with :except' do
525
519
  context 'as an Array' do
526
- include_examples 'import_filters examples'
527
-
528
- let(:except) { [:x] }
520
+ include_examples 'import_filters examples', nil, [:x]
529
521
  end
530
522
 
531
523
  context 'as an Symbol' do
532
- include_examples 'import_filters examples'
533
-
534
- let(:except) { :x }
524
+ include_examples 'import_filters examples', nil, :x
535
525
  end
536
526
  end
537
527
 
538
528
  context 'with :only & :except' do
539
- include_examples 'import_filters examples'
540
-
541
- let(:only) { [:x] }
542
- let(:except) { [:x] }
529
+ include_examples 'import_filters examples', [:x], [:x]
543
530
  end
544
531
  end
545
532
  end
@@ -10,7 +10,7 @@ describe ActiveInteraction::Missable do
10
10
  let(:slug) { :slug }
11
11
 
12
12
  it 'returns false' do
13
- expect(instance.respond_to?(slug)).to be_false
13
+ expect(instance.respond_to?(slug)).to be_falsey
14
14
  end
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ describe ActiveInteraction::Missable do
18
18
  let(:slug) { :boolean }
19
19
 
20
20
  it 'returns true' do
21
- expect(instance.respond_to?(slug)).to be_true
21
+ expect(instance.respond_to?(slug)).to be_truthy
22
22
  end
23
23
  end
24
24
  end
@@ -57,7 +57,7 @@ describe ActiveInteraction::Runnable do
57
57
  }
58
58
 
59
59
  klass.run
60
- expect(has_run).to be_true
60
+ expect(has_run).to be_truthy
61
61
  end
62
62
  end
63
63
  end
@@ -141,7 +141,10 @@ describe ActiveInteraction::Runnable do
141
141
 
142
142
  it 'does not duplicate errors on subsequent calls' do
143
143
  instance.valid?
144
- expect { instance.valid? }.to_not change { instance.errors.count }.by 1
144
+ count = instance.errors.count
145
+ instance.valid?
146
+
147
+ expect(instance.errors.count).to eql count
145
148
  end
146
149
  end
147
150
  end
@@ -47,25 +47,46 @@ describe ActiveInteraction::Transactable do
47
47
 
48
48
  describe '.transaction?' do
49
49
  it 'defaults to true' do
50
- expect(klass.transaction?).to be_true
50
+ expect(klass.transaction?).to be_truthy
51
51
  end
52
52
 
53
53
  it 'returns the stored value' do
54
54
  klass.transaction(false)
55
- expect(klass.transaction?).to be_false
55
+ expect(klass.transaction?).to be_falsey
56
+ end
57
+
58
+ context 'with a subclass' do
59
+ before { klass.transaction(false) }
60
+
61
+ let(:subclass) { Class.new(klass) }
62
+
63
+ it 'inherits from the superclass' do
64
+ expect(subclass.transaction?).to be_falsey
65
+ end
56
66
  end
57
67
  end
58
68
 
59
69
  describe '.transaction_options' do
70
+ let(:h) { { rand => rand } }
71
+
60
72
  it 'defaults to an empty hash' do
61
73
  expect(klass.transaction_options).to eql({})
62
74
  end
63
75
 
64
76
  it 'returns the stored value' do
65
- h = { rand => rand }
66
77
  klass.transaction(klass.transaction?, h)
67
78
  expect(klass.transaction_options).to eql h
68
79
  end
80
+
81
+ context 'with a subclass' do
82
+ before { klass.transaction(klass.transaction?, h) }
83
+
84
+ let(:subclass) { Class.new(klass) }
85
+
86
+ it 'inherits from the superclass' do
87
+ expect(subclass.transaction_options).to eql h
88
+ end
89
+ end
69
90
  end
70
91
 
71
92
  describe '#transaction' do
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  describe ActiveInteraction::Errors do
6
6
  let(:klass) do
7
7
  Class.new do
8
- include ActiveModel::Model
8
+ include ActiveInteraction::ActiveModelable
9
9
 
10
10
  attr_reader :attribute
11
11
 
@@ -42,7 +42,7 @@ describe ActiveInteraction::FilterColumn do
42
42
  let(:type) { :integer }
43
43
 
44
44
  it 'returns true' do
45
- expect(number?).to be_true
45
+ expect(number?).to be_truthy
46
46
  end
47
47
  end
48
48
 
@@ -50,7 +50,7 @@ describe ActiveInteraction::FilterColumn do
50
50
  let(:type) { :float }
51
51
 
52
52
  it 'returns true' do
53
- expect(number?).to be_true
53
+ expect(number?).to be_truthy
54
54
  end
55
55
  end
56
56
 
@@ -58,7 +58,7 @@ describe ActiveInteraction::FilterColumn do
58
58
  let(:type) { :string }
59
59
 
60
60
  it 'returns false' do
61
- expect(number?).to be_false
61
+ expect(number?).to be_falsey
62
62
  end
63
63
  end
64
64
  end
@@ -72,7 +72,7 @@ describe ActiveInteraction::FilterColumn do
72
72
  let(:type) { :string }
73
73
 
74
74
  it 'returns true' do
75
- expect(text?).to be_true
75
+ expect(text?).to be_truthy
76
76
  end
77
77
  end
78
78
 
@@ -80,7 +80,7 @@ describe ActiveInteraction::FilterColumn do
80
80
  let(:type) { :float }
81
81
 
82
82
  it 'returns false' do
83
- expect(text?).to be_false
83
+ expect(text?).to be_falsey
84
84
  end
85
85
  end
86
86
  end
@@ -10,7 +10,7 @@ describe ActiveInteraction::BooleanFilter, :filter do
10
10
  context 'falsey' do
11
11
  [false, '0', 'false', 'FALSE'].each do |value|
12
12
  it "returns false for #{value.inspect}" do
13
- expect(filter.cast(value)).to be_false
13
+ expect(filter.cast(value)).to be_falsey
14
14
  end
15
15
  end
16
16
  end
@@ -18,7 +18,7 @@ describe ActiveInteraction::BooleanFilter, :filter do
18
18
  context 'truthy' do
19
19
  [true, '1', 'true', 'TRUE'].each do |value|
20
20
  it "returns true for #{value.inspect}" do
21
- expect(filter.cast(value)).to be_true
21
+ expect(filter.cast(value)).to be_truthy
22
22
  end
23
23
  end
24
24
  end
@@ -3,5 +3,5 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'ModelInteraction' do
6
- it_behaves_like 'an interaction', :model, -> { Object }, class: Class
6
+ it_behaves_like 'an interaction', :model, -> { // }, class: Regexp
7
7
  end
@@ -5,11 +5,11 @@ require 'spec_helper'
5
5
  describe ActiveInteraction::InputProcessor do
6
6
  describe '.reserved?(name)' do
7
7
  it 'returns true for anything starting with "_interaction_"' do
8
- expect(described_class.reserved?('_interaction_')).to be_true
8
+ expect(described_class.reserved?('_interaction_')).to be_truthy
9
9
  end
10
10
 
11
11
  it 'returns false for anything else' do
12
- expect(described_class.reserved?(SecureRandom.hex)).to be_false
12
+ expect(described_class.reserved?(SecureRandom.hex)).to be_falsey
13
13
  end
14
14
  end
15
15
 
@@ -21,7 +21,7 @@ describe ActiveInteraction::Validation do
21
21
  let(:inputs) { { name: 1 } }
22
22
 
23
23
  before do
24
- filter.stub(:cast).and_return(1)
24
+ allow(filter).to receive(:cast).and_return(1)
25
25
  end
26
26
 
27
27
  it 'returns no errors' do
@@ -31,7 +31,7 @@ describe ActiveInteraction::Validation do
31
31
 
32
32
  context 'filter throws' do
33
33
  before do
34
- filter.stub(:cast).and_raise(exception)
34
+ allow(filter).to receive(:cast).and_raise(exception)
35
35
  end
36
36
 
37
37
  context 'InvalidValueError' do
data/spec/spec_helper.rb CHANGED
@@ -3,14 +3,17 @@
3
3
  require 'coveralls'
4
4
  Coveralls.wear!
5
5
 
6
+ require 'i18n'
7
+ if I18n.config.respond_to?(:enforce_available_locales)
8
+ I18n.config.enforce_available_locales = true
9
+ I18n.config.available_locales = %w[en hsilgne]
10
+ end
11
+
6
12
  require 'active_interaction'
7
13
 
8
14
  Dir['./spec/support/**/*.rb'].each { |f| require f }
9
15
 
10
16
  RSpec.configure do |config|
11
- config.treat_symbols_as_metadata_keys_with_true_values = true
12
17
  config.run_all_when_everything_filtered = true
13
18
  config.filter_run_including :focus
14
19
  end
15
-
16
- I18n.config.enforce_available_locales = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lasseigne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-12 00:00:00.000000000 Z
12
+ date: 2014-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3'
20
+ version: '3.2'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '5'
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '3'
30
+ version: '3.2'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5'
@@ -121,14 +121,14 @@ dependencies:
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.21.0
124
+ version: 0.24.1
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.21.0
131
+ version: 0.24.1
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: yard
134
134
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +143,20 @@ dependencies:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.8'
146
+ - !ruby/object:Gem::Dependency
147
+ name: rspec
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.0
153
+ type: :development
154
+ prerelease: false
155
+ version_requirements: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 3.0.0
146
160
  description: Manage application specific business logic.
147
161
  email:
148
162
  - aaron.lasseigne@gmail.com
@@ -251,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
265
  version: '0'
252
266
  requirements: []
253
267
  rubyforge_project:
254
- rubygems_version: 2.2.2
268
+ rubygems_version: 2.4.1
255
269
  signing_key:
256
270
  specification_version: 4
257
271
  summary: Manage application specific business logic.