Skip to content

Commit

Permalink
Add specs for RavenParameterFilterProcesser
Browse files Browse the repository at this point in the history
  • Loading branch information
osyoyu committed Sep 21, 2017
1 parent 7c60377 commit 2e8c3dd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spec/blouson/raven_parameter_filter_processer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'spec_helper'
require 'raven'
require 'blouson/raven_parameter_filter_processor'

RSpec.describe 'Blouson::RavenParameterFilterProcessor' do
describe 'process_request_headers' do
let(:filter_processor_class) {
Blouson::RavenParameterFilterProcessor.create(
[],
%w(Really-Sensitive-Header-That-Needs-To-Be-Filtered)
)
}

let(:value) {
{
request: {
headers: {
'Really-Sensitive-Header-That-Needs-To-Be-Filtered' => 'important_token',
'Insensitive-Header' => 'foo'
}
}
}
}

it 'filters headers in header_filters' do
processed_value = filter_processor_class.new.process(value)
expect(processed_value[:request][:headers]['Really-Sensitive-Header-That-Needs-To-Be-Filtered']).to eq('FILTERED')
end

it 'won\'t filter headers not in header_filters' do
processed_value = filter_processor_class.new.process(value)
expect(processed_value[:request][:headers]['Insensitive-Header']).to eq('foo')
end
end
end

0 comments on commit 2e8c3dd

Please sign in to comment.