Skip to content

Commit

Permalink
Update spec
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed May 15, 2017
1 parent ee985e6 commit 895eb33
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions spec/integration/shared_examples/rack_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,33 @@ def wait_for_a_request_with_body(body)
get '/crash', nil, 'HTTP_USER_AGENT' => 'Bot', 'HTTP_REFERER' => 'bingo.com'
end

it 'features url' do
it 'contains url' do
wait_for_a_request_with_body(
%r("context":{.*"url":"http://example\.org/crash".*})
)
end

it 'features hostname' do
it 'contains hostname' do
wait_for_a_request_with_body(/"context":{.*"hostname":".+".*}/)
end

it 'features userAgent' do
it 'contains userAgent' do
wait_for_a_request_with_body(/"context":{.*"userAgent":"Bot".*}/)
end
end
end

describe 'environment payload' do
before do
get '/crash', nil, 'HTTP_REFERER' => 'bingo.com'
end

it 'features referer' do
wait_for_a_request_with_body(/"environment":{.*"referer":"bingo.com".*}/)
end
it 'contains referer' do
wait_for_a_request_with_body(/"context":{.*"referer":"bingo.com".*}/)
end

it 'contains HTTP headers' do
wait_for_a_request_with_body(
/"environment":{.*"headers":{.*"CONTENT_LENGTH":"0".*}/
)
end
it 'contains HTTP headers' do
wait_for_a_request_with_body(
/"context":{.*"headers":{.*"CONTENT_LENGTH":"0".*}/
)
end

it 'contains HTTP method' do
wait_for_a_request_with_body(/"environment":{.*"httpMethod":"GET".*}/)
it 'contains HTTP method' do
wait_for_a_request_with_body(/"context":{.*"httpMethod":"GET".*}/)
end
end
end
end

0 comments on commit 895eb33

Please sign in to comment.