uncruft 0.0.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +30 -7
- data/lib/uncruft/deprecatable.rb +25 -0
- data/lib/uncruft/deprecation_handler.rb +2 -2
- data/lib/uncruft/version.rb +1 -1
- data/lib/uncruft/warning.rb +2 -2
- data/lib/uncruft.rb +3 -2
- data/spec/examples.txt +26 -22
- data/spec/uncruft/deprecatable_spec.rb +58 -0
- data/spec/uncruft/deprecation_handler_spec.rb +14 -14
- data/spec/uncruft/warning_spec.rb +5 -0
- data/spec/uncruft_spec.rb +23 -23
- metadata +10 -10
- data/spec/dummy/log/test.log +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6345bf4ac442c6ebf76e3ea890d51e37298bd857673f13f7ab3239bfffba93f9
|
4
|
+
data.tar.gz: f5fe054f25dbc340188fe7f425679e41981e28724ddc99d5e4f2c66d1dcea598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d8aa23de032a32889df43c2cd68e5a294449dd9d74d8172873ec6334899cb9924b6f1c080f58e228b7e8e69ffb909dac063bb7d0acea58b65848ac3146961e
|
7
|
+
data.tar.gz: ff7698ff75d7420b1ce01d22a6a87ec96abe0dab622b3893df80b0923722ea550415b66f0540110a12d0b7d99243a1c8845ca4cbf44b7d694ffdf56e434fca22
|
data/README.md
CHANGED
@@ -21,23 +21,46 @@ Then run `bundle install`.
|
|
21
21
|
|
22
22
|
By default, deprecation warnings will cause your application to raise exceptions in `test` and `development` modes.
|
23
23
|
|
24
|
-
The exception message will include the original deprecation warning, plus a link to [our troubleshooting guide](https://github.com/Betterment/uncruft/blob/
|
24
|
+
The exception message will include the original deprecation warning, plus a link to [our troubleshooting guide](https://github.com/Betterment/uncruft/blob/main/GUIDE.md), to assist with resolving deprecations as they are encountered.
|
25
25
|
|
26
|
-
##
|
26
|
+
## Recording Deprecations
|
27
27
|
|
28
|
-
When testing on a new Rails version for the first time, you will undoubtedly encounter many new warnings. As such, you can quickly
|
28
|
+
When testing on a new Rails version for the first time, you will undoubtedly encounter many new warnings. As such, you can quickly record all existing deprecation warnings encountered during your test suite like so:
|
29
29
|
|
30
30
|
```bash
|
31
|
-
|
31
|
+
RECORD_DEPRECATIONS=1 rake
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
This will generate (or add to) an ignorefile of warnings at `config/deprecations.ignore`. Any warning in that file will be ignored when next encountered.
|
35
|
+
|
36
|
+
You can also incrementally add new warnings to the ignorefile as you encounter them:
|
35
37
|
|
36
38
|
```bash
|
37
|
-
|
39
|
+
RECORD_DEPRECATIONS=1 rspec path/to/my/failing/spec.rb
|
38
40
|
```
|
39
41
|
|
40
|
-
|
42
|
+
## Deprecating Attributes and Methods
|
43
|
+
|
44
|
+
If you would like to deprecate an attribute by applying a `ActiveSupport::Deprecation` warning on the deprecated attribute's getters and setters then look no further, we have a tool for that! Simply include `Uncruft::Deprecatable` in your class, identify the attribute you would like deprecated and provide a message you would like applied to the deprecation warning.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
class Customer
|
48
|
+
include Uncruft::Deprecatable
|
49
|
+
|
50
|
+
attr_accessor :first_name
|
51
|
+
|
52
|
+
def initialize(first_name)
|
53
|
+
@first_name = first_name
|
54
|
+
end
|
55
|
+
|
56
|
+
deprecate_attribute(:first_name,
|
57
|
+
message: "Please stop using first_name it is deprecated, please use legal_first_name instead!")
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Within the `Uncruft::Deprecatable` module there is also a `.deprecate_method` method that can be used to apply a deprecation warning to an identified method, much like the `deprecate_attribute` method described above.
|
62
|
+
|
63
|
+
From there you can use Uncruft's deprecation recording tools to generate ingorefiles and manage your deprecation backlog in an organized manner.
|
41
64
|
|
42
65
|
## How to Contribute
|
43
66
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Uncruft
|
2
|
+
module Deprecatable
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def deprecate_attribute(attribute, message:)
|
7
|
+
deprecate_method attribute, message: message
|
8
|
+
deprecate_method :"#{attribute}=", message: message
|
9
|
+
end
|
10
|
+
|
11
|
+
def deprecate_method(method, message:)
|
12
|
+
prepended_method = Module.new
|
13
|
+
|
14
|
+
prepended_method.module_eval do
|
15
|
+
define_method method do |*args, &block|
|
16
|
+
ActiveSupport::Deprecation.warn(message)
|
17
|
+
super(*args, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
prepend prepended_method
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -15,7 +15,7 @@ module Uncruft
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def handle_unknown_deprecation!(message, line_number)
|
18
|
-
if Uncruft.
|
18
|
+
if Uncruft.record_deprecations?
|
19
19
|
known_deprecations << message
|
20
20
|
write_deprecations_file!
|
21
21
|
else
|
@@ -86,7 +86,7 @@ module Uncruft
|
|
86
86
|
To resolve this error, adjust your code according to the instructions above.
|
87
87
|
If you did not introduce this error or are unsure why you are seeing it,
|
88
88
|
you will find additional guidance at the URL below:
|
89
|
-
https://github.com/Betterment/uncruft/blob/
|
89
|
+
https://github.com/Betterment/uncruft/blob/main/GUIDE.md
|
90
90
|
ERROR
|
91
91
|
end
|
92
92
|
|
data/lib/uncruft/version.rb
CHANGED
data/lib/uncruft/warning.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Uncruft
|
2
2
|
module Warning
|
3
|
-
DEPRECATION_PATTERN = /(deprecation|deprecated)/i
|
3
|
+
DEPRECATION_PATTERN = /(deprecation|deprecated)/i.freeze
|
4
4
|
|
5
|
-
def warn(str)
|
5
|
+
def warn(str, *args)
|
6
6
|
if str =~ DEPRECATION_PATTERN # rubocop:disable Performance/RegexpMatch
|
7
7
|
message = strip_caller_info(str, caller_locations(1..1).first).strip
|
8
8
|
ActiveSupport::Deprecation.warn(message)
|
data/lib/uncruft.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'uncruft/version'
|
2
2
|
require 'uncruft/railtie'
|
3
3
|
require 'uncruft/deprecation_handler'
|
4
|
+
require 'uncruft/deprecatable'
|
4
5
|
require 'uncruft/warning'
|
5
6
|
|
6
7
|
module Uncruft
|
@@ -8,8 +9,8 @@ module Uncruft
|
|
8
9
|
# http://api.rubyonrails.org/classes/ActiveModel/Type/Boolean.html
|
9
10
|
FALSE_VALUES = [false, 0, "0", "f", "F", "false", "FALSE", "off", "OFF"].to_set
|
10
11
|
|
11
|
-
def
|
12
|
-
ENV['
|
12
|
+
def record_deprecations?
|
13
|
+
ENV['RECORD_DEPRECATIONS'].presence && !FALSE_VALUES.include?(ENV['RECORD_DEPRECATIONS'])
|
13
14
|
end
|
14
15
|
|
15
16
|
def ignorefile_path
|
data/spec/examples.txt
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/uncruft/
|
4
|
-
./spec/uncruft/
|
5
|
-
./spec/uncruft/
|
6
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
7
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
8
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
9
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
10
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
11
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
12
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:6:
|
13
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
14
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
15
|
-
./spec/uncruft/deprecation_handler_spec.rb[1:1:
|
16
|
-
./spec/uncruft/
|
17
|
-
./spec/uncruft/
|
18
|
-
./spec/uncruft/
|
19
|
-
./spec/uncruft/
|
20
|
-
./spec/uncruft/
|
21
|
-
./spec/uncruft/
|
22
|
-
./spec/
|
23
|
-
./spec/
|
24
|
-
./spec/
|
3
|
+
./spec/uncruft/deprecatable_spec.rb[1:1:1] | passed | 0.00763 seconds |
|
4
|
+
./spec/uncruft/deprecatable_spec.rb[1:1:2] | passed | 0.00031 seconds |
|
5
|
+
./spec/uncruft/deprecatable_spec.rb[1:2:1] | passed | 0.00025 seconds |
|
6
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:1] | passed | 0.00536 seconds |
|
7
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:2:1] | passed | 0.00786 seconds |
|
8
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:2:2:1] | passed | 0.00347 seconds |
|
9
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:3:1] | passed | 0.00061 seconds |
|
10
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:4:1] | passed | 0.00039 seconds |
|
11
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:5:1] | passed | 0.00044 seconds |
|
12
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:6:1] | passed | 0.00054 seconds |
|
13
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:6:2:1] | passed | 0.00045 seconds |
|
14
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:6:3:1] | passed | 0.00058 seconds |
|
15
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:6:3:2:1] | passed | 0.00066 seconds |
|
16
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:7:1] | passed | 0.00047 seconds |
|
17
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:8:1] | passed | 0.00302 seconds |
|
18
|
+
./spec/uncruft/deprecation_handler_spec.rb[1:1:8:2:1] | passed | 0.00166 seconds |
|
19
|
+
./spec/uncruft/railtie_spec.rb[1:1] | passed | 0.04267 seconds |
|
20
|
+
./spec/uncruft/railtie_spec.rb[1:2:1] | passed | 0.00167 seconds |
|
21
|
+
./spec/uncruft/railtie_spec.rb[1:3:1] | passed | 0.00219 seconds |
|
22
|
+
./spec/uncruft/warning_spec.rb[1:1] | passed | 0.00031 seconds |
|
23
|
+
./spec/uncruft/warning_spec.rb[1:2] | passed | 0.00011 seconds |
|
24
|
+
./spec/uncruft/warning_spec.rb[1:3:1] | passed | 0.00054 seconds |
|
25
|
+
./spec/uncruft/warning_spec.rb[1:3:2:1] | passed | 0.00045 seconds |
|
26
|
+
./spec/uncruft_spec.rb[1:1:1] | passed | 0.00246 seconds |
|
27
|
+
./spec/uncruft_spec.rb[1:2:1] | passed | 0.00025 seconds |
|
28
|
+
./spec/uncruft_spec.rb[1:2:2:1] | passed | 0.00024 seconds |
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Uncruft::Deprecatable do
|
4
|
+
let(:my_name) { "Jess" }
|
5
|
+
|
6
|
+
subject { klass.new }
|
7
|
+
|
8
|
+
describe '.deprecate_attribute' do
|
9
|
+
let(:klass) do
|
10
|
+
Class.new do
|
11
|
+
include Uncruft::Deprecatable
|
12
|
+
|
13
|
+
attr_accessor :first_name
|
14
|
+
|
15
|
+
deprecate_attribute(:first_name,
|
16
|
+
message: "Please stop using this attribute!")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'applies deprecation warning when setting deprecated attribute' do
|
21
|
+
expect(ActiveSupport::Deprecation).to receive(:warn).once
|
22
|
+
.with("Please stop using this attribute!")
|
23
|
+
|
24
|
+
expect(subject.first_name = my_name).to eq my_name
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'applies deprecation warning when getting deprecated attribute' do
|
28
|
+
subject.instance_variable_set(:@first_name, my_name)
|
29
|
+
|
30
|
+
expect(ActiveSupport::Deprecation).to receive(:warn)
|
31
|
+
.with("Please stop using this attribute!")
|
32
|
+
|
33
|
+
expect(subject.first_name).to eq my_name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.deprecate_method' do
|
38
|
+
let(:klass) do
|
39
|
+
Class.new do
|
40
|
+
include Uncruft::Deprecatable
|
41
|
+
|
42
|
+
def legacy_method
|
43
|
+
"Hello Old World!"
|
44
|
+
end
|
45
|
+
|
46
|
+
deprecate_method(:legacy_method,
|
47
|
+
message: "Please stop using this method!")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'applies deprecation warning when calling the deprecated method' do
|
52
|
+
expect(ActiveSupport::Deprecation).to receive(:warn)
|
53
|
+
.with("Please stop using this method!")
|
54
|
+
|
55
|
+
expect(subject.legacy_method).to eq "Hello Old World!"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -14,8 +14,8 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
14
14
|
let(:line_number) { 123 }
|
15
15
|
let(:caller_label) { '<something>' }
|
16
16
|
let(:message) { "Warning: BAD called from #{caller_label} at #{absolute_path}:#{line_number}" }
|
17
|
-
let(:
|
18
|
-
let(:expected_error) { "#{
|
17
|
+
let(:expected_ignorefile_entry) { 'Warning: BAD called from <something> at chicken/nuggets.rb' }
|
18
|
+
let(:expected_error) { "#{expected_ignorefile_entry}:123" }
|
19
19
|
let(:expected_error_message) do
|
20
20
|
<<~ERROR.strip
|
21
21
|
#{expected_error}
|
@@ -23,7 +23,7 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
23
23
|
To resolve this error, adjust your code according to the instructions above.
|
24
24
|
If you did not introduce this error or are unsure why you are seeing it,
|
25
25
|
you will find additional guidance at the URL below:
|
26
|
-
https://github.com/Betterment/uncruft/blob/
|
26
|
+
https://github.com/Betterment/uncruft/blob/main/GUIDE.md
|
27
27
|
ERROR
|
28
28
|
end
|
29
29
|
|
@@ -31,14 +31,14 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
31
31
|
expect { subject.call(message, '') }.to raise_error(RuntimeError, expected_error_message)
|
32
32
|
end
|
33
33
|
|
34
|
-
context 'when
|
34
|
+
context 'when recording new deprecations' do
|
35
35
|
before do
|
36
|
-
allow(Uncruft).to receive(:
|
36
|
+
allow(Uncruft).to receive(:record_deprecations?).and_return(true)
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'sanitizes the message and writes it to the file' do
|
40
40
|
expect { subject.call(message, '') }.to change { File.exist?(ignorefile_path) }.from(false).to(true)
|
41
|
-
expect(File.read(ignorefile_path)).to include(
|
41
|
+
expect(File.read(ignorefile_path)).to include(expected_ignorefile_entry)
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'when timecop is enabled' do
|
@@ -57,7 +57,7 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
57
57
|
|
58
58
|
context 'when caller is an erb file' do
|
59
59
|
let(:caller_label) { '_app_views_bananas_show__1234_567890' }
|
60
|
-
let(:
|
60
|
+
let(:expected_ignorefile_entry) { 'Warning: BAD called from chicken/nuggets.rb' }
|
61
61
|
|
62
62
|
it 'sanitizes the message and raises an error' do
|
63
63
|
expect { subject.call(message, '') }.to raise_error(RuntimeError, expected_error_message)
|
@@ -66,7 +66,7 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
66
66
|
|
67
67
|
context 'when caller is "top (required)"' do
|
68
68
|
let(:caller_label) { '<top (required)>' }
|
69
|
-
let(:
|
69
|
+
let(:expected_ignorefile_entry) { 'Warning: BAD called from <global scope> at chicken/nuggets.rb' }
|
70
70
|
|
71
71
|
it 'sanitizes the caller and raises an error' do
|
72
72
|
expect { subject.call(message, '') }.to raise_error(RuntimeError, expected_error_message)
|
@@ -75,7 +75,7 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
75
75
|
|
76
76
|
context 'when caller is "main"' do
|
77
77
|
let(:caller_label) { '<main>' }
|
78
|
-
let(:
|
78
|
+
let(:expected_ignorefile_entry) { 'Warning: BAD called from <global scope> at chicken/nuggets.rb' }
|
79
79
|
|
80
80
|
it 'sanitizes the caller and raises an error' do
|
81
81
|
expect { subject.call(message, '') }.to raise_error(RuntimeError, expected_error_message)
|
@@ -84,7 +84,7 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
84
84
|
|
85
85
|
context 'when message includes custom gem path' do
|
86
86
|
let(:absolute_path) { Pathname.new('/banana/banana/banana/gems/chicken/nuggets.rb') }
|
87
|
-
let(:
|
87
|
+
let(:expected_ignorefile_entry) { "Warning: BAD called from <something> at $GEM_PATH/chicken/nuggets.rb" }
|
88
88
|
|
89
89
|
before do
|
90
90
|
allow(ENV).to receive(:[]).and_call_original
|
@@ -122,14 +122,14 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
122
122
|
|
123
123
|
context 'when caller is not a filepath' do
|
124
124
|
let(:absolute_path) { '(pry)' }
|
125
|
-
let(:
|
125
|
+
let(:expected_ignorefile_entry) { 'Warning: BAD called from <something> at (pry)' }
|
126
126
|
|
127
127
|
it 'sanitizes the message and raises an error' do
|
128
128
|
expect { subject.call(message, '') }.to raise_error(RuntimeError, expected_error_message)
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
context 'when
|
132
|
+
context 'when ignorefile exists' do
|
133
133
|
let(:message) { "Warning: BAD called from #{absolute_path}:#{line_number}" }
|
134
134
|
let(:file_content) do
|
135
135
|
<<~IGNOREFILE
|
@@ -154,11 +154,11 @@ RSpec.describe Uncruft::DeprecationHandler do
|
|
154
154
|
expect { subject.call(message, '') }.not_to change { File.read(ignorefile_path) }
|
155
155
|
end
|
156
156
|
|
157
|
-
context 'when
|
157
|
+
context 'when recording new deprecations' do
|
158
158
|
let(:line_number) { '456' }
|
159
159
|
|
160
160
|
before do
|
161
|
-
allow(Uncruft).to receive(:
|
161
|
+
allow(Uncruft).to receive(:record_deprecations?).and_return(true)
|
162
162
|
end
|
163
163
|
|
164
164
|
it 'does not raise an error and leaves the file intact' do
|
@@ -12,6 +12,11 @@ describe Uncruft::Warning do
|
|
12
12
|
Warning.warn('oh no, you should worry')
|
13
13
|
end
|
14
14
|
|
15
|
+
it "accepts kwargs from Kernel.warn" do
|
16
|
+
warn('oh no, you should worry', uplevel: 1)
|
17
|
+
Kernel.warn('oh no, you should worry', uplevel: 1)
|
18
|
+
end
|
19
|
+
|
15
20
|
context 'when warning includes the word "deprecation" or "deprecated"' do
|
16
21
|
it 'treats it as a deprecation warning' do
|
17
22
|
expect(ActiveSupport::Deprecation).to receive(:warn).and_return('banana').exactly(6).times
|
data/spec/uncruft_spec.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Uncruft do
|
4
|
-
describe '.
|
4
|
+
describe '.record_deprecations?' do
|
5
5
|
it 'handles common truthy and falsy values' do
|
6
|
-
allow(ENV).to receive(:[]).with('
|
7
|
-
expect(described_class.
|
8
|
-
allow(ENV).to receive(:[]).with('
|
9
|
-
expect(described_class.
|
10
|
-
allow(ENV).to receive(:[]).with('
|
11
|
-
expect(described_class.
|
12
|
-
allow(ENV).to receive(:[]).with('
|
13
|
-
expect(described_class.
|
14
|
-
allow(ENV).to receive(:[]).with('
|
15
|
-
expect(described_class.
|
16
|
-
allow(ENV).to receive(:[]).with('
|
17
|
-
expect(described_class.
|
18
|
-
allow(ENV).to receive(:[]).with('
|
19
|
-
expect(described_class.
|
20
|
-
allow(ENV).to receive(:[]).with('
|
21
|
-
expect(described_class.
|
22
|
-
allow(ENV).to receive(:[]).with('
|
23
|
-
expect(described_class.
|
24
|
-
allow(ENV).to receive(:[]).with('
|
25
|
-
expect(described_class.
|
26
|
-
allow(ENV).to receive(:[]).with('
|
27
|
-
expect(described_class.
|
6
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('1')
|
7
|
+
expect(described_class.record_deprecations?).to eq true
|
8
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('t')
|
9
|
+
expect(described_class.record_deprecations?).to eq true
|
10
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('T')
|
11
|
+
expect(described_class.record_deprecations?).to eq true
|
12
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('true')
|
13
|
+
expect(described_class.record_deprecations?).to eq true
|
14
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('TRUE')
|
15
|
+
expect(described_class.record_deprecations?).to eq true
|
16
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('0')
|
17
|
+
expect(described_class.record_deprecations?).to eq false
|
18
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('f')
|
19
|
+
expect(described_class.record_deprecations?).to eq false
|
20
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('F')
|
21
|
+
expect(described_class.record_deprecations?).to eq false
|
22
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('false')
|
23
|
+
expect(described_class.record_deprecations?).to eq false
|
24
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('FALSE')
|
25
|
+
expect(described_class.record_deprecations?).to eq false
|
26
|
+
allow(ENV).to receive(:[]).with('RECORD_DEPRECATIONS').and_return('')
|
27
|
+
expect(described_class.record_deprecations?).to be_nil
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uncruft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Griffith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: rubocop-betterment
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: timecop
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,16 +107,17 @@ files:
|
|
107
107
|
- README.md
|
108
108
|
- Rakefile
|
109
109
|
- lib/uncruft.rb
|
110
|
+
- lib/uncruft/deprecatable.rb
|
110
111
|
- lib/uncruft/deprecation_handler.rb
|
111
112
|
- lib/uncruft/railtie.rb
|
112
113
|
- lib/uncruft/version.rb
|
113
114
|
- lib/uncruft/warning.rb
|
114
115
|
- spec/dummy/config/application.rb
|
115
116
|
- spec/dummy/config/deprecations.ignore
|
116
|
-
- spec/dummy/log/test.log
|
117
117
|
- spec/examples.txt
|
118
118
|
- spec/spec_helper.rb
|
119
119
|
- spec/support/rails_root.rb
|
120
|
+
- spec/uncruft/deprecatable_spec.rb
|
120
121
|
- spec/uncruft/deprecation_handler_spec.rb
|
121
122
|
- spec/uncruft/railtie_spec.rb
|
122
123
|
- spec/uncruft/warning_spec.rb
|
@@ -140,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.6.13
|
144
|
+
rubygems_version: 3.0.1
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A library to assist with Rails upgrades
|
@@ -149,10 +149,10 @@ test_files:
|
|
149
149
|
- spec/spec_helper.rb
|
150
150
|
- spec/dummy/config/deprecations.ignore
|
151
151
|
- spec/dummy/config/application.rb
|
152
|
-
- spec/dummy/log/test.log
|
153
152
|
- spec/examples.txt
|
154
153
|
- spec/uncruft/railtie_spec.rb
|
155
154
|
- spec/uncruft/warning_spec.rb
|
155
|
+
- spec/uncruft/deprecatable_spec.rb
|
156
156
|
- spec/uncruft/deprecation_handler_spec.rb
|
157
157
|
- spec/support/rails_root.rb
|
158
158
|
- spec/uncruft_spec.rb
|
data/spec/dummy/log/test.log
DELETED
File without changes
|