auto_strip_attributes 2.6.0 → 3.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +33 -0
- data/.gitignore +3 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +9 -12
- data/README.md +3 -6
- data/auto_strip_attributes.gemspec +5 -5
- data/lib/auto_strip_attributes/version.rb +1 -1
- data/lib/auto_strip_attributes.rb +1 -1
- data/test/auto_strip_attributes_test.rb +38 -39
- metadata +22 -17
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb3998df403526b1e7258ced7b401f9990c989b2121e8659d4ae40300d88bcc3
|
|
4
|
+
data.tar.gz: e644dd91393eacf2d9e15b14d9a63d90abaab7e581fd0d7a656e088eeeaec939
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb9915a1b90873dee827cccb6326ff96e8e27dd8f907eafd37942bb5ecd0b6b1efa748d40bff2c6a6b34b54d3df346ec524960329a5b6f2643f030dd731446cd
|
|
7
|
+
data.tar.gz: a077c6f15fe1ed51aea18d3ebfb51aaf60f35a1747469312e2289ffce65a141ba7b5813b96b47a5686ba4ec96388c4f8e13c6cbd2ee0dd6766def1da6fabd186
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
include:
|
|
17
|
+
- { ruby-version: '3.1', rails-version: '7.1' }
|
|
18
|
+
- { ruby-version: '3.3', rails-version: '7.2' }
|
|
19
|
+
- { ruby-version: '3.3', rails-version: '8.0' }
|
|
20
|
+
- { ruby-version: '3.4', rails-version: '8.1' }
|
|
21
|
+
|
|
22
|
+
env:
|
|
23
|
+
RAILS_VERSION: ${{ matrix.rails-version }}
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
28
|
+
uses: ruby/setup-ruby@v1
|
|
29
|
+
with:
|
|
30
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
31
|
+
bundler-cache: true
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
## [Master]
|
|
2
2
|
|
|
3
|
+
## 3.0.0 (2026-08-30)
|
|
4
|
+
|
|
5
|
+
- Dropped support for Rails < 7.1 and Ruby < 3.1
|
|
6
|
+
- Added support for Rails 7.1, 7.2, 8.0, 8.1
|
|
7
|
+
- Fixed `MiniTest::Mock` reference (removed in minitest 6) to `Minitest::Mock`
|
|
8
|
+
|
|
3
9
|
## [2.6]
|
|
4
10
|
|
|
5
11
|
- Support for `array` attributes (thnks to [@sharshenov](https://github.com/holli/auto_strip_attributes/pull/29))
|
data/Gemfile
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
source "
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
# Specify your gem's dependencies in auto_strip_attributes.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
+
# Test against a specific Rails minor: RAILS_VERSION=7.2 bundle install
|
|
7
|
+
rails_version = ENV["RAILS_VERSION"]
|
|
8
|
+
if rails_version
|
|
9
|
+
gem "rails", "~> #{rails_version}.0"
|
|
10
|
+
else
|
|
11
|
+
gem "rails"
|
|
12
|
+
end
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
# http://schneems.com/post/50991826838/testing-against-multiple-rails-versions
|
|
9
|
-
rails_version = ENV["RAILS_VERSION"] || "default"
|
|
10
|
-
|
|
11
|
-
case rails_version
|
|
12
|
-
when "default"
|
|
13
|
-
gem "rails"
|
|
14
|
-
else
|
|
15
|
-
gem "rails", "~> #{rails_version}"
|
|
16
|
-
end
|
|
17
|
-
|
|
14
|
+
gem "minitest", "~> 5.25"
|
|
18
15
|
|
data/README.md
CHANGED
|
@@ -7,7 +7,6 @@ It works by adding a before_validation hook to the record. No other methods are
|
|
|
7
7
|
|
|
8
8
|
Gem has option to set empty strings to nil or to remove extra spaces inside the string.
|
|
9
9
|
|
|
10
|
-
[](https://travis-ci.org/holli/auto_strip_attributes)
|
|
11
10
|
[](https://rubygems.org/gems/auto_strip_attributes/)
|
|
12
11
|
[](https://rubygems.org/gems/auto_strip_attributes/)
|
|
13
12
|
|
|
@@ -19,7 +18,7 @@ Include gem in your Gemfile:
|
|
|
19
18
|
gem "auto_strip_attributes", "~> 2.6"
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
Example ActiveRecord usage:
|
|
21
|
+
Example ActiveRecord usage:
|
|
23
22
|
|
|
24
23
|
```ruby
|
|
25
24
|
class User < ActiveRecord::Base
|
|
@@ -121,7 +120,7 @@ end
|
|
|
121
120
|
|
|
122
121
|
AutoStripAttributes::Config.setup accepts following options
|
|
123
122
|
|
|
124
|
-
- :
|
|
123
|
+
- :clear_previous => true, to clear all filters
|
|
125
124
|
- :defaults => true, to set three default filters mentioned above
|
|
126
125
|
|
|
127
126
|
|
|
@@ -132,9 +131,7 @@ AutoStripAttributes::Config.setup accepts following options
|
|
|
132
131
|
|
|
133
132
|
# Requirements
|
|
134
133
|
|
|
135
|
-
Gem has been tested with newest Ruby & Rails combination and it probably works also with older versions. See test matrix at https://github.com/holli/auto_strip_attributes/blob/master/.
|
|
136
|
-
|
|
137
|
-
[](https://travis-ci.org/holli/auto_strip_attributes)
|
|
134
|
+
Gem has been tested with newest Ruby & Rails combination and it probably works also with older versions. See test matrix at https://github.com/holli/auto_strip_attributes/blob/master/.github/workflows/ci.yaml
|
|
138
135
|
|
|
139
136
|
# Support
|
|
140
137
|
|
|
@@ -11,21 +11,21 @@ Gem::Specification.new do |s|
|
|
|
11
11
|
s.summary = "Removes unnecessary whitespaces in attributes. Extension to ActiveRecord or ActiveModel."
|
|
12
12
|
s.description = "AutoStripAttributes helps to remove unnecessary whitespaces from ActiveRecord or ActiveModel attributes. It's good for removing accidental spaces from user inputs. It works by adding a before_validation hook to the record. It has option to set empty strings to nil or to remove extra spaces inside the string."
|
|
13
13
|
s.license = "MIT"
|
|
14
|
+
s.required_ruby_version = ">= 3.1"
|
|
14
15
|
|
|
15
16
|
s.rubyforge_project = "auto_strip_attributes"
|
|
16
17
|
|
|
17
18
|
s.files = `git ls-files`.split("\n")
|
|
18
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
20
|
s.require_paths = ["lib"]
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
s.add_runtime_dependency "activerecord", ">=
|
|
23
|
+
s.add_runtime_dependency "activerecord", ">= 7.1", "< 9"
|
|
24
24
|
|
|
25
25
|
#s.add_development_dependency "activerecord", ">= 3.0"
|
|
26
|
-
s.add_development_dependency "minitest", ">=
|
|
27
|
-
s.add_development_dependency "mocha", "~>
|
|
28
|
-
s.add_development_dependency 'rake'
|
|
26
|
+
s.add_development_dependency "minitest", ">= 3.0"
|
|
27
|
+
s.add_development_dependency "mocha", "~> 2.1"
|
|
28
|
+
s.add_development_dependency 'rake', '>= 13.0'
|
|
29
29
|
# s.add_development_dependency 'pry'
|
|
30
30
|
|
|
31
31
|
end
|
|
@@ -61,7 +61,7 @@ class AutoStripAttributes::Config
|
|
|
61
61
|
end
|
|
62
62
|
set_filter(nullify: true) do |value|
|
|
63
63
|
# We check for blank? and empty? because rails uses empty? inside blank?
|
|
64
|
-
# e.g.
|
|
64
|
+
# e.g. Minitest::Mock.new() only responds to .blank? but not empty?, check tests for more info
|
|
65
65
|
# Basically same as value.blank? ? nil : value
|
|
66
66
|
(value.respond_to?(:'blank?') and value.respond_to?(:'empty?') and value.blank?) ? nil : value
|
|
67
67
|
end
|
|
@@ -6,7 +6,7 @@ require 'minitest/autorun'
|
|
|
6
6
|
require 'minitest/spec'
|
|
7
7
|
require "active_record"
|
|
8
8
|
require "auto_strip_attributes"
|
|
9
|
-
require 'mocha/
|
|
9
|
+
require 'mocha/minitest'
|
|
10
10
|
|
|
11
11
|
# if you need debug, add relevant line to auto_strip_attributes.gemspec
|
|
12
12
|
# s.add_development_dependency 'pry'
|
|
@@ -59,14 +59,14 @@ describe AutoStripAttributes do
|
|
|
59
59
|
@record = MockRecordBasic.new()
|
|
60
60
|
@record.boo = " aaa \t"
|
|
61
61
|
@record.valid?
|
|
62
|
-
@record.boo
|
|
62
|
+
assert_equal @record.boo, " aaa \t"
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
it "should strip when conditional is met" do
|
|
66
66
|
@record = MockRecordBasic.new()
|
|
67
67
|
@record.boo = " bbb \t"
|
|
68
68
|
@record.valid?
|
|
69
|
-
@record.boo
|
|
69
|
+
assert_equal @record.boo, "bbb"
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -80,28 +80,28 @@ describe AutoStripAttributes do
|
|
|
80
80
|
@record = MockRecordBasic.new()
|
|
81
81
|
@record.foo = " aaa \t"
|
|
82
82
|
@record.valid?
|
|
83
|
-
@record.foo
|
|
83
|
+
assert_equal @record.foo, "aaa"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it "should be ok for strings arrays" do
|
|
87
87
|
@record = MockRecordBasic.new()
|
|
88
88
|
@record.foo = [" aaa \t", " "]
|
|
89
89
|
@record.valid?
|
|
90
|
-
@record.foo
|
|
90
|
+
assert_equal @record.foo, ["aaa"]
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
it "should not delete non breaking spaces" do
|
|
94
94
|
@record = MockRecordBasic.new()
|
|
95
95
|
@record.foo = " aaa \t\u00A0"
|
|
96
96
|
@record.valid?
|
|
97
|
-
@record.foo
|
|
97
|
+
assert_equal @record.foo, "aaa \t\u00A0"
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it "should be ok for normal strings and not squish things" do
|
|
101
101
|
@record = MockRecordBasic.new()
|
|
102
102
|
@record.foo = " aaa bbb "
|
|
103
103
|
@record.valid?
|
|
104
|
-
@record.foo
|
|
104
|
+
assert_equal @record.foo, "aaa bbb"
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
|
|
@@ -109,14 +109,14 @@ describe AutoStripAttributes do
|
|
|
109
109
|
@record = MockRecordBasic.new()
|
|
110
110
|
@record.foo = " "
|
|
111
111
|
@record.valid?
|
|
112
|
-
@record.foo
|
|
112
|
+
assert_nil @record.foo
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
it "should set empty strings arrays to nil" do
|
|
116
116
|
@record = MockRecordBasic.new()
|
|
117
117
|
@record.foo = [" "]
|
|
118
118
|
@record.valid?
|
|
119
|
-
@record.foo
|
|
119
|
+
assert_nil @record.foo
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
it "should call strip method to attribute if possible" do
|
|
@@ -125,8 +125,7 @@ describe AutoStripAttributes do
|
|
|
125
125
|
str_mock.expects(:strip).returns(@stripped_str="stripped_str_here")
|
|
126
126
|
@record.foo = str_mock
|
|
127
127
|
@record.valid?
|
|
128
|
-
|
|
129
|
-
@record.foo.must_be_same_as @stripped_str
|
|
128
|
+
assert_equal @record.foo, @stripped_str
|
|
130
129
|
|
|
131
130
|
#str_mock.expect :'nil?', false
|
|
132
131
|
#str_mock.expect :strip, (@stripped_str="stripped_str_here")
|
|
@@ -139,7 +138,7 @@ describe AutoStripAttributes do
|
|
|
139
138
|
it "should not call strip or nullify method for non strippable attributes" do
|
|
140
139
|
@record = MockRecordBasic.new()
|
|
141
140
|
|
|
142
|
-
str_mock =
|
|
141
|
+
str_mock = Minitest::Mock.new() # answers false to str_mock.respond_to?(:strip) and respond_to?(:blank)
|
|
143
142
|
# Mock.new is problematic in ruby 1.9 because it responds to blank? but doesn't respond to !
|
|
144
143
|
# rails blank? method returns !self if an object doesn't respond to :empty?
|
|
145
144
|
# Now we check in the validator also for :empty? so !self is never called.
|
|
@@ -164,7 +163,7 @@ describe AutoStripAttributes do
|
|
|
164
163
|
@record = MockRecordWithConvertNBSP.new()
|
|
165
164
|
@record.foo = " aaa \t\u00A0"
|
|
166
165
|
@record.valid?
|
|
167
|
-
@record.foo
|
|
166
|
+
assert_equal @record.foo, "aaa"
|
|
168
167
|
end
|
|
169
168
|
|
|
170
169
|
end
|
|
@@ -181,14 +180,14 @@ describe AutoStripAttributes do
|
|
|
181
180
|
@record = MockRecordWithNullify.new
|
|
182
181
|
@record.foo = " "
|
|
183
182
|
@record.valid?
|
|
184
|
-
@record.foo
|
|
183
|
+
assert_equal @record.foo, ""
|
|
185
184
|
end
|
|
186
185
|
|
|
187
186
|
it "should not set blank strings arrays to nil" do
|
|
188
187
|
@record = MockRecordWithNullify.new()
|
|
189
188
|
@record.foo = [" "]
|
|
190
189
|
@record.valid?
|
|
191
|
-
@record.foo
|
|
190
|
+
assert_equal @record.foo, [""]
|
|
192
191
|
end
|
|
193
192
|
end
|
|
194
193
|
|
|
@@ -204,7 +203,7 @@ describe AutoStripAttributes do
|
|
|
204
203
|
@record = MockRecordWithNullifyArray.new
|
|
205
204
|
@record.foo = [" "]
|
|
206
205
|
@record.valid?
|
|
207
|
-
@record.foo
|
|
206
|
+
assert_equal @record.foo, []
|
|
208
207
|
end
|
|
209
208
|
end
|
|
210
209
|
|
|
@@ -219,14 +218,14 @@ describe AutoStripAttributes do
|
|
|
219
218
|
@record = MockRecordWithSqueeze.new
|
|
220
219
|
@record.foo = " aaa \u0009 \u000A \u000B \u000C \u000D \u0020 \u0085 \u00A0 \u1680 \u2000 \u2001 \u2002 \u2003 \u2004 \u2005 \u2006 \u2007 \u2008 \u2009 \u200A \u2028 \u2029 \u202F \u205F \u3000 bbb \u00A0 "
|
|
221
220
|
@record.valid?
|
|
222
|
-
@record.foo
|
|
221
|
+
assert_equal @record.foo, "aaa bbb"
|
|
223
222
|
end
|
|
224
223
|
|
|
225
224
|
it "should do normal nullify with empty string" do
|
|
226
225
|
@record = MockRecordWithSqueeze.new
|
|
227
226
|
@record.foo = " "
|
|
228
227
|
@record.valid?
|
|
229
|
-
@record.foo
|
|
228
|
+
assert_nil @record.foo
|
|
230
229
|
end
|
|
231
230
|
end
|
|
232
231
|
|
|
@@ -241,7 +240,7 @@ describe AutoStripAttributes do
|
|
|
241
240
|
@record = MockRecordWithDelete.new
|
|
242
241
|
@record.foo = " a \t bbb"
|
|
243
242
|
@record.valid?
|
|
244
|
-
@record.foo
|
|
243
|
+
assert_equal @record.foo, "abbb"
|
|
245
244
|
end
|
|
246
245
|
end
|
|
247
246
|
|
|
@@ -268,12 +267,12 @@ describe AutoStripAttributes do
|
|
|
268
267
|
@record.quux = [" foo\tfoo", " "]
|
|
269
268
|
@record.quuz = [" "]
|
|
270
269
|
@record.valid?
|
|
271
|
-
@record.foo
|
|
272
|
-
@record.bar
|
|
273
|
-
@record.baz
|
|
274
|
-
@record.qux
|
|
275
|
-
@record.quux
|
|
276
|
-
@record.quuz
|
|
270
|
+
assert_equal @record.foo, "foo\tfoo"
|
|
271
|
+
assert_nil @record.bar
|
|
272
|
+
assert_equal @record.baz, ""
|
|
273
|
+
assert_nil @record.qux
|
|
274
|
+
assert_equal @record.quux, ["foo foo", ""]
|
|
275
|
+
assert_equal @record.quuz, []
|
|
277
276
|
end
|
|
278
277
|
end
|
|
279
278
|
|
|
@@ -291,9 +290,9 @@ describe AutoStripAttributes do
|
|
|
291
290
|
it "should not call setter again in before_validation" do
|
|
292
291
|
@record = MockRecordWithCustomSetter.new
|
|
293
292
|
@record.foo = " foo "
|
|
294
|
-
@record.foo
|
|
293
|
+
assert_equal @record.foo, " foo - foo "
|
|
295
294
|
@record.valid?
|
|
296
|
-
@record.foo
|
|
295
|
+
assert_equal @record.foo, "foo - foo"
|
|
297
296
|
end
|
|
298
297
|
end
|
|
299
298
|
|
|
@@ -316,9 +315,9 @@ describe AutoStripAttributes do
|
|
|
316
315
|
it "should handle everything ok" do
|
|
317
316
|
@record = MockVirtualAttribute.new
|
|
318
317
|
@record.foo = " foo "
|
|
319
|
-
@record.foo
|
|
318
|
+
assert_equal @record.foo, " foo "
|
|
320
319
|
@record.valid?
|
|
321
|
-
@record.foo
|
|
320
|
+
assert_equal @record.foo, "foo"
|
|
322
321
|
end
|
|
323
322
|
end
|
|
324
323
|
|
|
@@ -330,7 +329,7 @@ describe AutoStripAttributes do
|
|
|
330
329
|
it "should have default filters set in right order" do
|
|
331
330
|
AutoStripAttributes::Config.setup(clear_previous: true)
|
|
332
331
|
filters_order = AutoStripAttributes::Config.filters_order
|
|
333
|
-
filters_order
|
|
332
|
+
assert_equal filters_order, [:convert_non_breaking_spaces, :strip, :nullify, :nullify_array, :squish, :delete_whitespaces]
|
|
334
333
|
end
|
|
335
334
|
|
|
336
335
|
it "should reset filters to defaults when :clear is true" do
|
|
@@ -341,7 +340,7 @@ describe AutoStripAttributes do
|
|
|
341
340
|
end
|
|
342
341
|
AutoStripAttributes::Config.setup(clear_previous: true)
|
|
343
342
|
filters_order = AutoStripAttributes::Config.filters_order
|
|
344
|
-
filters_order
|
|
343
|
+
assert_equal filters_order, [:convert_non_breaking_spaces, :strip, :nullify, :nullify_array, :squish, :delete_whitespaces]
|
|
345
344
|
end
|
|
346
345
|
|
|
347
346
|
it "should remove all filters when :clear is true and :defaults is false" do
|
|
@@ -352,7 +351,7 @@ describe AutoStripAttributes do
|
|
|
352
351
|
end
|
|
353
352
|
AutoStripAttributes::Config.setup(clear_previous: true, defaults: false)
|
|
354
353
|
filter_order = AutoStripAttributes::Config.filters_order
|
|
355
|
-
filter_order
|
|
354
|
+
assert_equal filter_order, []
|
|
356
355
|
|
|
357
356
|
# returning to original state
|
|
358
357
|
AutoStripAttributes::Config.setup(clear_previous: true)
|
|
@@ -374,14 +373,14 @@ describe AutoStripAttributes do
|
|
|
374
373
|
filters_order = AutoStripAttributes::Config.filters_order
|
|
375
374
|
filters_enabled = AutoStripAttributes::Config.filters_enabled
|
|
376
375
|
|
|
377
|
-
filters_order
|
|
376
|
+
assert_equal filters_order, [:convert_non_breaking_spaces, :strip, :nullify, :nullify_array, :squish, :delete_whitespaces, :test]
|
|
378
377
|
assert Proc === filters_block[:test]
|
|
379
|
-
filters_enabled[:test]
|
|
378
|
+
assert_equal filters_enabled[:test], true
|
|
380
379
|
|
|
381
380
|
@record = MockRecordWithCustomFilter.new
|
|
382
381
|
@record.foo = " FOO "
|
|
383
382
|
@record.valid?
|
|
384
|
-
@record.foo
|
|
383
|
+
assert_equal @record.foo, "foo"
|
|
385
384
|
|
|
386
385
|
# returning to original state
|
|
387
386
|
AutoStripAttributes::Config.setup(clear_previous: true)
|
|
@@ -411,7 +410,7 @@ describe AutoStripAttributes do
|
|
|
411
410
|
@record = CustomOptionsMockRecord.new
|
|
412
411
|
@record.foo = " abcdefghijklmnopqrstijklmn"
|
|
413
412
|
@record.valid?
|
|
414
|
-
@record.foo
|
|
413
|
+
assert_equal @record.foo, "abcd…"
|
|
415
414
|
end
|
|
416
415
|
end
|
|
417
416
|
|
|
@@ -443,21 +442,21 @@ describe AutoStripAttributes do
|
|
|
443
442
|
@record = ComplexFirstMockRecord.new
|
|
444
443
|
@record.foo = " FOO "
|
|
445
444
|
@record.valid?
|
|
446
|
-
@record.foo
|
|
445
|
+
assert_equal @record.foo, "FOO"
|
|
447
446
|
end
|
|
448
447
|
|
|
449
448
|
it "should use extra filters when given" do
|
|
450
449
|
@record = ComplexFirstMockRecord.new
|
|
451
450
|
@record.bar_downcase = " BAR "
|
|
452
451
|
@record.valid?
|
|
453
|
-
@record.bar_downcase
|
|
452
|
+
assert_equal @record.bar_downcase, "bar"
|
|
454
453
|
end
|
|
455
454
|
|
|
456
455
|
it "should use extra filters when given and also respect given other configs" do
|
|
457
456
|
@record = ComplexFirstMockRecord.new
|
|
458
457
|
@record.bar_downcase = " "
|
|
459
458
|
@record.valid?
|
|
460
|
-
@record.bar_downcase
|
|
459
|
+
assert_equal @record.bar_downcase, ""
|
|
461
460
|
end
|
|
462
461
|
end
|
|
463
462
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auto_strip_attributes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Olli Huotari
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-09-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -16,56 +16,62 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7.1'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '9'
|
|
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
|
-
version: '
|
|
29
|
+
version: '7.1'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '9'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: minitest
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
30
36
|
requirements:
|
|
31
37
|
- - ">="
|
|
32
38
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
39
|
+
version: '3.0'
|
|
34
40
|
type: :development
|
|
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:
|
|
46
|
+
version: '3.0'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
48
|
name: mocha
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
|
44
50
|
requirements:
|
|
45
51
|
- - "~>"
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
53
|
+
version: '2.1'
|
|
48
54
|
type: :development
|
|
49
55
|
prerelease: false
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
58
|
- - "~>"
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
60
|
+
version: '2.1'
|
|
55
61
|
- !ruby/object:Gem::Dependency
|
|
56
62
|
name: rake
|
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
|
58
64
|
requirements:
|
|
59
65
|
- - ">="
|
|
60
66
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
67
|
+
version: '13.0'
|
|
62
68
|
type: :development
|
|
63
69
|
prerelease: false
|
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
71
|
requirements:
|
|
66
72
|
- - ">="
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
74
|
+
version: '13.0'
|
|
69
75
|
description: AutoStripAttributes helps to remove unnecessary whitespaces from ActiveRecord
|
|
70
76
|
or ActiveModel attributes. It's good for removing accidental spaces from user inputs.
|
|
71
77
|
It works by adding a before_validation hook to the record. It has option to set
|
|
@@ -76,8 +82,8 @@ executables: []
|
|
|
76
82
|
extensions: []
|
|
77
83
|
extra_rdoc_files: []
|
|
78
84
|
files:
|
|
85
|
+
- ".github/workflows/ci.yaml"
|
|
79
86
|
- ".gitignore"
|
|
80
|
-
- ".travis.yml"
|
|
81
87
|
- CHANGELOG.md
|
|
82
88
|
- Gemfile
|
|
83
89
|
- README.md
|
|
@@ -92,7 +98,7 @@ homepage: https://github.com/holli/auto_strip_attributes
|
|
|
92
98
|
licenses:
|
|
93
99
|
- MIT
|
|
94
100
|
metadata: {}
|
|
95
|
-
post_install_message:
|
|
101
|
+
post_install_message:
|
|
96
102
|
rdoc_options: []
|
|
97
103
|
require_paths:
|
|
98
104
|
- lib
|
|
@@ -100,16 +106,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
100
106
|
requirements:
|
|
101
107
|
- - ">="
|
|
102
108
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
109
|
+
version: '3.1'
|
|
104
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
111
|
requirements:
|
|
106
112
|
- - ">="
|
|
107
113
|
- !ruby/object:Gem::Version
|
|
108
114
|
version: '0'
|
|
109
115
|
requirements: []
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
signing_key:
|
|
116
|
+
rubygems_version: 3.5.22
|
|
117
|
+
signing_key:
|
|
113
118
|
specification_version: 4
|
|
114
119
|
summary: Removes unnecessary whitespaces in attributes. Extension to ActiveRecord
|
|
115
120
|
or ActiveModel.
|