ETL 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/etl.rb +10 -0
- data/lib/etl/version.rb +1 -1
- data/spec/etl_spec.rb +88 -0
- metadata +1 -1
data/lib/etl.rb
CHANGED
@@ -69,6 +69,8 @@ class ETL
|
|
69
69
|
# for any given variable included in the method name's array
|
70
70
|
(ORDERED_ETL_OPERATIONS - [:etl]).each do |method|
|
71
71
|
define_method method do |*args, &block|
|
72
|
+
warn_args_will_be_deprecated_for method unless args.empty?
|
73
|
+
|
72
74
|
if block
|
73
75
|
instance_variable_set("@#{method}", block)
|
74
76
|
else
|
@@ -79,6 +81,8 @@ class ETL
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def etl *args, &block
|
84
|
+
warn_args_will_be_deprecated_for :etl unless args.empty?
|
85
|
+
|
82
86
|
if block_given?
|
83
87
|
@etl = block
|
84
88
|
else
|
@@ -114,6 +118,8 @@ class ETL
|
|
114
118
|
# for any given variable included in the method name's array
|
115
119
|
ITERATOR_OPERATIONS.each do |method|
|
116
120
|
define_method method do |*args, &block|
|
121
|
+
warn_args_will_be_deprecated_for method unless args.empty?
|
122
|
+
|
117
123
|
if block
|
118
124
|
instance_variable_set("@_#{method}_block", block)
|
119
125
|
else
|
@@ -142,6 +148,10 @@ class ETL
|
|
142
148
|
|
143
149
|
private
|
144
150
|
|
151
|
+
def warn_args_will_be_deprecated_for method
|
152
|
+
warn "DEPRECATED: passing arguments to ##{method} will be removed in an upcoming release and will raise an exception. Please remove this from your code."
|
153
|
+
end
|
154
|
+
|
145
155
|
def iterate?
|
146
156
|
ITERATOR_OPERATIONS.all? do |method|
|
147
157
|
instance_variable_defined?("@_#{method}_block")
|
data/lib/etl/version.rb
CHANGED
data/spec/etl_spec.rb
CHANGED
@@ -38,6 +38,94 @@ end
|
|
38
38
|
describe ETL do
|
39
39
|
let(:logger) { nil }
|
40
40
|
|
41
|
+
describe "deprecations" do
|
42
|
+
let(:etl) { described_class.new }
|
43
|
+
|
44
|
+
context "#ensure_destination" do
|
45
|
+
it "does not warn when no args are passed" do
|
46
|
+
etl.should_receive(:warn).never
|
47
|
+
etl.ensure_destination {}
|
48
|
+
end
|
49
|
+
|
50
|
+
it "warns when args are passed that this is deprecated" do
|
51
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #ensure_destination will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
52
|
+
etl.ensure_destination('some arg') {}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "#before_etl" do
|
57
|
+
it "does not warn when no args are passed" do
|
58
|
+
etl.should_receive(:warn).never
|
59
|
+
etl.before_etl {}
|
60
|
+
end
|
61
|
+
|
62
|
+
it "warns when args are passed that this is deprecated" do
|
63
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #before_etl will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
64
|
+
etl.before_etl('some arg') {}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "#start" do
|
69
|
+
it "does not warn when no args are passed" do
|
70
|
+
etl.should_receive(:warn).never
|
71
|
+
etl.start {}
|
72
|
+
end
|
73
|
+
|
74
|
+
it "warns when args are passed that this is deprecated" do
|
75
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #start will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
76
|
+
etl.start('some arg') {}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "#step" do
|
81
|
+
it "does not warn when no args are passed" do
|
82
|
+
etl.should_receive(:warn).never
|
83
|
+
etl.step {}
|
84
|
+
end
|
85
|
+
|
86
|
+
it "warns when args are passed that this is deprecated" do
|
87
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #step will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
88
|
+
etl.step('some arg') {}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "#stop" do
|
93
|
+
it "does not warn when no args are passed" do
|
94
|
+
etl.should_receive(:warn).never
|
95
|
+
etl.stop {}
|
96
|
+
end
|
97
|
+
|
98
|
+
it "warns when args are passed that this is deprecated" do
|
99
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #stop will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
100
|
+
etl.stop('some arg') {}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "#etl" do
|
105
|
+
it "does not warn when no args are passed" do
|
106
|
+
etl.should_receive(:warn).never
|
107
|
+
etl.etl {}
|
108
|
+
end
|
109
|
+
|
110
|
+
it "warns when args are passed that this is deprecated" do
|
111
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #etl will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
112
|
+
etl.etl('some arg') {}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "#after_etl" do
|
117
|
+
it "does not warn when no args are passed" do
|
118
|
+
etl.should_receive(:warn).never
|
119
|
+
etl.after_etl {}
|
120
|
+
end
|
121
|
+
|
122
|
+
it "warns when args are passed that this is deprecated" do
|
123
|
+
etl.should_receive(:warn).with("DEPRECATED: passing arguments to #after_etl will be removed in an upcoming release and will raise an exception. Please remove this from your code.")
|
124
|
+
etl.after_etl('some arg') {}
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
41
129
|
describe ".connection=" do
|
42
130
|
let(:class_level_connection) { stub('class_level_connection') }
|
43
131
|
|