Skip to content

Commit

Permalink
Add unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored and lloeki committed Oct 26, 2022
1 parent 6e2c5c6 commit e7f1bb8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/datadog/tracing/contrib/rack/middlewares_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,27 @@
end
end
end

# Non-ASCII URLs cannot be tested with `rack-test` as of v2.0.2.
# It would be ideal if that was possible, as we could create integration tests
# for such cases.
#
# As an alternative, we test the parsing method directly.
describe '#parse_url' do
subject(:parse_url) { middleware.send(:parse_url, env, original_env) }
let(:env) { { 'REQUEST_URI' => uri, 'HTTP_HOST' => 'localhost:443', 'rack.url_scheme' => 'https' } }
let(:original_env) { {} }

context 'with Unicode characters' do
let(:uri) { 'https://localhost/success/?繋がってて' }

it { is_expected.to eq(uri) }
end

context 'with unencoded ASCII characters' do
let(:uri) { 'https://localhost/success/|' }

it { is_expected.to eq(uri) }
end
end
end

0 comments on commit e7f1bb8

Please sign in to comment.