8000 Drop logging in Rough by zanker · Pull Request #6 · square/rough · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Drop logging in Rough #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/rough/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module BaseController

def self.included(base)
base.class_eval do
before_action :log_proto, if: :rpc?
alias_method_chain :params, :request_proto
end
end
Expand Down Expand Up @@ -60,10 +59,6 @@ def rpc?
rpc_name
end

def log_proto
Rails.logger.info(" Request Proto: #{request_proto.inspect}")
end

def rpc_name
params_without_request_proto[:rpc]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rough/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Rough
VERSION = '0.2.6'
VERSION = '0.2.7'
end
18 changes: 0 additions & 18 deletions spec/examples/base_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ class FakeResponseProto < Protobuf::Message
expect(response.status).to eq(TestController::STATUS)
end

it 'should log the request proto' do
rp = FakeRequestProto.new({ name: 'john', rpc: 'Fake#fake', action: 'test', controller: 'test' }.stringify_keys)
expect(Rails.logger).to have_received(:info).with(" Request Proto: #{rp.inspect}")
end

it 'should respond with json' do
expect(response.content_type).to eq('application/json')
end
Expand All @@ -46,7 +41,6 @@ class FakeResponseProto < Protobuf::Message
context 'and called over json' do

before do
allow(Rails.logger).to receive(:info)
post '/test-rpc', {
name: 'john'
}.to_json, 'Content-Type' => 'application/json', 'Accept' => 'application/json'
Expand All @@ -56,11 +50,6 @@ class FakeResponseProto < Protobuf::Message
expect(response.status).to eq(TestController::STATUS)
end

it 'should log the request proto' do
rp = FakeRequestProto.new({ name: 'john', rpc: 'Fake#fake', action: 'test', controller: 'test' }.stringify_keys)
expect(Rails.logger).to have_received(:info).with(" Request Proto: #{rp.inspect}")
end

it 'should respond with json' do
expect(response.content_type).to eq('application/json')
end
Expand All @@ -74,7 +63,6 @@ class FakeResponseProto < Protobuf::Message
let(:mime) { Rough::BaseController::PROTO_MIME.to_s }

before do
allow(Rails.logger).to receive(:info)
post '/test-rpc', echo_request.encode, 'Content-Type' => mime, 'Accept' => mime
end

Expand Down Expand Up @@ -120,19 +108,13 @@ class FakeResponseProto < Protobuf::Message
context 'when the route is not rpc' do

before do
allow(Rails.logger).to receive(:info)
post '/test-not-rpc', name: 'john'
end

it 'should pass back the response status' do
expect(response.status).to eq(TestController::STATUS)
end

it 'should not log the request proto' do
rp = OpenStruct.new(name: 'john', rpc: 'Fake#fake', action: 'test', controller: 'test')
expect(Rails.logger).not_to have_received(:info).with(" Request Proto: #{rp.inspect}")
end

end

end
0