Skip to content

Commit d479388

Browse files
committed
Fix method redefinition warnings
These are harmless but I'm trying to get my application warning free because warnings tend to point nasty bugs. ``` lib/twilio-ruby/util/configuration.rb:8: warning: method redefined; discarding old account_sid= lib/twilio-ruby/util/configuration.rb:12: warning: method redefined; discarding old auth_token= lib/twilio-ruby/util/configuration.rb:16: warning: method redefined; discarding old http_client= lib/twilio-ruby/util/configuration.rb:20: warning: method redefined; discarding old region= lib/twilio-ruby/util/configuration.rb:24: warning: method redefined; discarding old edge= lib/twilio-ruby/util/configuration.rb:28: warning: method redefined; discarding old logger= ``` There are a number of warnings left but I can't fix them because they are in generated code. Almost all of them have to do witht the `context` method: ``` lib/twilio-ruby/rest/studio/v1/flow/engagement.rb:321: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/engagement.rb:282: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb:162: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb:143: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb:293: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb:249: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb:170: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb:150: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/execution.rb:367: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/execution.rb:328: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb:163: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb:144: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step.rb:299: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step.rb:255: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb:173: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb:153: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v2/flow/execution.rb:360: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v2/flow/execution.rb:327: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb:163: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb:144: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb:299: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb:255: warning: previous definition of context was here lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb:173: warning: method redefined; discarding old context lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb:153: warning: previous definition of context was here lib/twilio-ruby/twiml/voice_response.rb:794: warning: method redefined; discarding old initialize lib/twilio-ruby/twiml/messaging_response.rb:50: warning: previous definition of initialize was here ```
1 parent 9db28f6 commit d479388

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/twilio-ruby/util/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Twilio
44
module Util
55
class Configuration
6-
attr_accessor :account_sid, :auth_token, :http_client, :region, :edge, :logger
6+
attr_reader :account_sid, :auth_token, :http_client, :region, :edge, :logger
77

88
def account_sid=(value)
99
@account_sid = value

spec/rack/twilio_webhook_authentication_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
expect(Twilio::Security::RequestValidator).to receive(:new).with(auth_token).and_return(request_validator)
3838
expect(request_validator).to receive(:validate).and_return(true)
3939
request = Rack::MockRequest.env_for('/voice')
40-
status, headers, body = @middleware.call(request)
40+
status, _headers, _body = @middleware.call(request)
4141
expect(status).to be(200)
4242
end
4343
end
@@ -50,7 +50,7 @@
5050
it 'should not intercept when the path doesn\'t match' do
5151
expect(Twilio::Security::RequestValidator).to_not receive(:validate)
5252
request = Rack::MockRequest.env_for('/sms')
53-
status, headers, body = @middleware.call(request)
53+
status, _headers, _body = @middleware.call(request)
5454
expect(status).to be(200)
5555
end
5656

@@ -59,7 +59,7 @@
5959
receive(:validate).and_return(true)
6060
)
6161
request = Rack::MockRequest.env_for('/voice')
62-
status, headers, body = @middleware.call(request)
62+
status, _headers, _body = @middleware.call(request)
6363
expect(status).to be(200)
6464
end
6565

@@ -68,7 +68,7 @@
6868
receive(:validate).and_return(false)
6969
)
7070
request = Rack::MockRequest.env_for('/voice')
71-
status, headers, body = @middleware.call(request)
71+
status, _headers, _body = @middleware.call(request)
7272
expect(status).to be(403)
7373
end
7474
end
@@ -81,7 +81,7 @@
8181
it 'should not intercept when the path doesn\'t match' do
8282
expect(Twilio::Security::RequestValidator).to_not receive(:validate)
8383
request = Rack::MockRequest.env_for('icesms')
84-
status, headers, body = @middleware.call(request)
84+
status, _headers, _body = @middleware.call(request)
8585
expect(status).to be(200)
8686
end
8787

@@ -90,7 +90,7 @@
9090
receive(:validate).and_return(true)
9191
)
9292
request = Rack::MockRequest.env_for('/sms')
93-
status, headers, body = @middleware.call(request)
93+
status, _headers, _body = @middleware.call(request)
9494
expect(status).to be(200)
9595
end
9696

@@ -99,7 +99,7 @@
9999
receive(:validate).and_return(false)
100100
)
101101
request = Rack::MockRequest.env_for('/sms')
102-
status, headers, body = @middleware.call(request)
102+
status, _headers, _body = @middleware.call(request)
103103
expect(status).to be(403)
104104
end
105105
end

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$VERBOSE = true
2+
13
require 'simplecov'
24
SimpleCov.start
35

0 commit comments

Comments
 (0)