@@ -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' ) 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