Skip to content

Commit

Permalink
Fix method redefinition warnings
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
byroot committed Sep 18, 2024
1 parent 9db28f6 commit d479388
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/twilio-ruby/util/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Twilio
module Util
class Configuration
attr_accessor :account_sid, :auth_token, :http_client, :region, :edge, :logger
attr_reader :account_sid, :auth_token, :http_client, :region, :edge, :logger

def account_sid=(value)
@account_sid = value
Expand Down
14 changes: 7 additions & 7 deletions spec/rack/twilio_webhook_authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
expect(Twilio::Security::RequestValidator).to receive(:new).with(auth_token).and_return(request_validator)
expect(request_validator).to receive(:validate).and_return(true)
request = Rack::MockRequest.env_for('/voice')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(200)
end
end
Expand All @@ -50,7 +50,7 @@
it 'should not intercept when the path doesn\'t match' do
expect(Twilio::Security::RequestValidator).to_not receive(:validate)
request = Rack::MockRequest.env_for('/sms')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(200)
end

Expand All @@ -59,7 +59,7 @@
receive(:validate).and_return(true)
)
request = Rack::MockRequest.env_for('/voice')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(200)
end

Expand All @@ -68,7 +68,7 @@
receive(:validate).and_return(false)
)
request = Rack::MockRequest.env_for('/voice')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(403)
end
end
Expand All @@ -81,7 +81,7 @@
it 'should not intercept when the path doesn\'t match' do
expect(Twilio::Security::RequestValidator).to_not receive(:validate)
request = Rack::MockRequest.env_for('icesms')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(200)
end

Expand All @@ -90,7 +90,7 @@
receive(:validate).and_return(true)
)
request = Rack::MockRequest.env_for('/sms')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(200)
end

Expand All @@ -99,7 +99,7 @@
receive(:validate).and_return(false)
)
request = Rack::MockRequest.env_for('/sms')
status, headers, body = @middleware.call(request)
status, _headers, _body = @middleware.call(request)
expect(status).to be(403)
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$VERBOSE = true

require 'simplecov'
SimpleCov.start

Expand Down

0 comments on commit d479388

Please sign in to comment.