as_deprecation_tracker 1.2.0 → 1.3.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: 8c9e8fd0e5c19889d05575d93539fde6cbd82f90
4
- data.tar.gz: 6fc07fb3155fe02e64510b1e2fa7d53440a1e0b8
3
+ metadata.gz: 319c016e3c0d157afe5bf366597bbe08c3f7b8a1
4
+ data.tar.gz: c497cffa7fb8a20754ec0bcf0c041735f1a7e8b6
5
5
  SHA512:
6
- metadata.gz: f4782ab953d838c2ff817d490078117d54bff31a8ecedbda70f271c3f265847333425019a3fb75a60e7309dd6a162530757e4a35906e113d33e7a2d0945a5613
7
- data.tar.gz: 8bcff72162a895eefeb70f0bf8409562b4d9beb38248f9124c7038bb955370aef46dc6fd828e60821d98d31a2d9292f64747ed16320436a30118a46bc58cef47
6
+ metadata.gz: ac1bba14823514e09b4b5421d3fca0a265b0b26edb9fddfcd72eb2994bc148ef7107f1f7058fcbe771bb2d21ae9eb22c43591a0876085645d672d021a5fd34c6
7
+ data.tar.gz: 0c807d54d2e662c98a7988ae5e9df30fa262cbebbe54788d4401d67281a5b8a9f52b51d9b52abc7d5dac5c4cd9943727b98f6482be071381f1eace9da4ec0380
data/README.md CHANGED
@@ -88,9 +88,8 @@ number may vary by up to ten lines from the recorded number by default (see
88
88
  `line_tolerance` to tune). Usually the filename and method name are sufficient
89
89
  to match the caller without needing line numbers.
90
90
 
91
- The message is an exact string match, but if it's a multi-line message then not
92
- all lines need to be specified. Only the first lines given will be compared
93
- against the deprecation message.
91
+ The message is an exact string match on the _start_ of the deprecation message,
92
+ so not all of the original deprecation message needs to be specified.
94
93
 
95
94
  Additional whitelist files may be placed below the root of each Rails engine
96
95
  and will be loaded at startup in addition to the main Rails root config file.
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ASDeprecationTracker
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
@@ -21,7 +21,7 @@ module ASDeprecationTracker
21
21
  end
22
22
 
23
23
  def load_file(path)
24
- add_to_list(YAML.safe_load(File.read(path), [Symbol]))
24
+ add_to_list(YAML.safe_load(File.read(path), [Symbol]) || [])
25
25
  end
26
26
 
27
27
  def matches?(deprecation)
@@ -11,7 +11,6 @@ module ASDeprecationTracker
11
11
  @callstack = callstack_to_files_lines(Array.wrap(callstack))
12
12
  @engine_root = engine.present? ? engine_root(engine) : nil
13
13
  @message = message
14
- @message_lines = message.lines.map(&:chomp) if message
15
14
  end
16
15
 
17
16
  # rubocop:disable Metrics/CyclomaticComplexity
@@ -26,10 +25,7 @@ module ASDeprecationTracker
26
25
  private
27
26
 
28
27
  def message_matches?(message)
29
- message = clean_message(message)
30
- return true if message == @message
31
- return true if message.lines[0, @message_lines.length].map(&:chomp) == @message_lines
32
- false
28
+ clean_message(message).start_with?(@message)
33
29
  end
34
30
 
35
31
  def clean_message(message)
@@ -19,6 +19,10 @@ class WhitelistEntryTest < ASDeprecationTracker::TestCase
19
19
  end
20
20
 
21
21
  def test_matches_partial_message
22
+ assert entry(callstack: nil, message: "a\nb").matches?(deprecation(message: "a\nb c"))
23
+ end
24
+
25
+ def test_matches_partial_message_lines
22
26
  assert entry(callstack: nil, message: "a\nb").matches?(deprecation(message: "a\nb\nc"))
23
27
  end
24
28
 
@@ -34,6 +34,12 @@ class WhitelistTest < ASDeprecationTracker::TestCase
34
34
  assert_equal 1, @whitelist.list.count
35
35
  end
36
36
 
37
+ def test_load_file_empty
38
+ File.expects(:read).with('root/config/as_deprecation_whitelist.yaml').returns('---')
39
+ @whitelist.load_file('root/config/as_deprecation_whitelist.yaml')
40
+ assert_equal 0, @whitelist.list.count
41
+ end
42
+
37
43
  def test_matches_failure
38
44
  @whitelist.add_to_list([entry])
39
45
  deprecation = mock('deprecation')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: as_deprecation_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Cleal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport