strip_attributes 1.10.0 → 1.10.1

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
  SHA256:
3
- metadata.gz: a302a928491058ebb14ecdb965d4afe5a1d56b9dd4306cb25a2bc1a8857dbed1
4
- data.tar.gz: 8b93e69476d0976effd53ae0c4904e9f522def8b6ad7526fcf2699b5d94dcf80
3
+ metadata.gz: 49befdc57853f5989b4fc51155992959980603b2f6faced6def64dcd79433c6b
4
+ data.tar.gz: 573f57793b9863e54fdde65b4dbf88e0d145098466e365ba91f595036ef16359
5
5
  SHA512:
6
- metadata.gz: 4de02ed6d9ea918c62704cf9a486d98912f5806bb06d817023667d60a56e3c12b634b2f22b9d6e39913188152ec3983986072a4a95b6daa4152b5191641c9ae8
7
- data.tar.gz: 2d757d642d005cf16fc25d49156d84e88401e4c0d72463703e79632c440a7a7f5f440b63e3c430e8349cda72ce0dfdbe432e94877a7ffe29ab7fadb5e8d41a12
6
+ metadata.gz: 2adee723efb508757540eb6a6fcc87a4fd24408e97174614e36bf29e80b06c0c209e0deb78e9416add3af0bbcb3e7719611d9e5ceefeef4f9cd777c5dde75a7e
7
+ data.tar.gz: 8cf717ef066842affe6d4f160fca46b2bcec3ea17afbaa03119b7312b2556d859e36b992a904570faa3f12dcbeea02bf5a05fbc3a464d87a17a1335c59ab54e0
@@ -52,12 +52,14 @@ module StripAttributes
52
52
 
53
53
  def self.strip_string(value, options = {})
54
54
  return value unless value.is_a?(String)
55
+ # TODO: FUTURE CHANGE: return value if value.frozen?
55
56
 
56
57
  allow_empty = options[:allow_empty]
57
58
  collapse_spaces = options[:collapse_spaces]
58
59
  replace_newlines = options[:replace_newlines]
59
60
  regex = options[:regex]
60
61
 
62
+ value = value.dup
61
63
  value.gsub!(regex, "") if regex
62
64
 
63
65
  if MULTIBYTE_SUPPORTED && Encoding.compatible?(value, MULTIBYTE_SPACE)
@@ -54,7 +54,7 @@ module StripAttributes
54
54
  alias_method :negative_failure_message, :failure_message_when_negated # RSpec 1.1
55
55
 
56
56
  def description
57
- "#{expectation(false)} whitespace from ##{@attribute}"
57
+ "#{expectation(false)} whitespace from #{@attributes.map {|el| "##{el}" }.to_sentence}"
58
58
  end
59
59
 
60
60
  private
@@ -1,3 +1,3 @@
1
1
  module StripAttributes
2
- VERSION = "1.10.0"
2
+ VERSION = "1.10.1"
3
3
  end
@@ -13,6 +13,7 @@ module MockAttributes
13
13
  base.attribute :qux
14
14
  base.attribute :strip_me
15
15
  base.attribute :skip_me
16
+ base.attribute :frozen
16
17
  end
17
18
  end
18
19
 
@@ -203,6 +204,12 @@ class StripAttributesTest < Minitest::Test
203
204
  assert_equal "", record.bang
204
205
  end
205
206
 
207
+ def test_should_strip_frozen_values
208
+ record = StripAllMockRecord.new(frozen: " ice ".freeze)
209
+ record.valid?
210
+ assert_equal "ice", record.frozen
211
+ end
212
+
206
213
  def test_should_collapse_duplicate_spaces
207
214
  record = CollapseDuplicateSpaces.new(@init_params)
208
215
  record.valid?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strip_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan McGeary
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel