Skip to content

Commit fce2697

Browse files
committed
.
Signed-off-by: Gil Desmarais <[email protected]>
1 parent edd5bd0 commit fce2697

File tree

5 files changed

+31
-124
lines changed

5 files changed

+31
-124
lines changed

.github/workflows/test_build_push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- uses: ruby/setup-ruby@v1
3030
with:
3131
bundler-cache: true
32+
cache-version: 1
3233

3334
- run: bundle exec rspec
3435

app.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def self.development? = ENV['RACK_ENV'] == 'development'
7272
end
7373

7474
route do |r|
75+
@show_backtrace = !ENV['CI'].empty? || self.class.development?
76+
7577
r.public
7678
r.hash_branches('')
7779

spec/fixtures/vcr_cassettes/auto_source-github-h2r-web.yml

Lines changed: 16 additions & 15 deletions
Large diffs are not rendered by default.

spec/fixtures/vcr_cassettes/auto_source-h2r-web.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

spec/routes/auto_source_spec.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def app = described_class
1212
let(:request_headers) do
1313
{ 'HTTP_HOST' => 'localhost' }
1414
end
15+
let(:encoded_url) { Base64.urlsafe_encode64('https://github.com/html2rss/html2rss-web/commits/master') }
1516

1617
let(:username) { 'username' }
1718
let(:password) { 'password' }
@@ -66,14 +67,17 @@ def app = described_class
6667
describe "GET '/auto_source/:encoded_url'" do
6768
context 'with provided basic auth' do
6869
subject(:response) do
69-
VCR.use_cassette 'auto_source-h2r-web' do
70-
get "/auto_source/#{Base64.urlsafe_encode64('https://github.com/html2rss/html2rss-web')}",
70+
VCR.use_cassette('auto_source-github-h2r-web', match_requests_on: [:path]) do
71+
get "/auto_source/#{encoded_url}?strategy",
7172
{},
7273
request_headers.merge('HTTP_AUTHORIZATION' => basic_authorize(username, password))
7374
end
7475
end
7576

7677
it 'responds successfully', :aggregate_failures do
78+
puts '*' * 80
79+
puts response.body
80+
puts '*' * 80
7781
expect(response).to be_ok
7882
expect(response.body).to start_with '<?xml version="1.0" encoding="UTF-8"?>'
7983
expect(response.get_header('cache-control')).to eq 'must-revalidate, private, max-age=0'
@@ -83,9 +87,11 @@ def app = described_class
8387

8488
context 'when strategy is not registered' do
8589
subject(:response) do
86-
get "/auto_source/#{Base64.urlsafe_encode64('https://github.com/html2rss/html2rss-web')}?strategy=nope",
87-
{},
88-
request_headers.merge('HTTP_AUTHORIZATION' => basic_authorize(username, password))
90+
VCR.use_cassette('auto_source-github-h2r-web', match_requests_on: [:path]) do
91+
get "/auto_source/#{encoded_url}?strategy=nope",
92+
{},
93+
request_headers.merge('HTTP_AUTHORIZATION' => basic_authorize(username, password))
94+
end
8995
end
9096

9197
it 'responds with Error', :aggregate_failures do
@@ -111,7 +117,7 @@ def app = described_class
111117

112118
describe "GET '/auto_source/:encoded_url'" do
113119
it 'responds with 400 Bad Request', :aggregate_failures do
114-
get "/auto_source/#{Base64.urlsafe_encode64('https://github.com/html2rss/html2rss-web')}",
120+
get "/auto_source/#{encoded_url}",
115121
{},
116122
request_headers.merge('HTTP_AUTHORIZATION' => basic_authorize(username, password))
117123

0 commit comments

Comments
 (0)