File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ def shorten(url)
268268 response = http ( GIT_IO_URL , request )
269269 case response . code
270270 when "200"
271- URI . join ( GIT_IO_URL , response . body )
271+ URI . join ( GIT_IO_URL , response . body ) . to_s
272272 when "201"
273273 response [ 'Location' ]
274274 else
Original file line number Diff line number Diff line change 11describe '...' do
22 before do
33 stub_request ( :post , /api\. github.com\/ gists/ ) . to_return ( :body => '{"html_url": "http://github.com/"}' )
4- stub_request ( :post , "http://git.io/" ) . to_return ( :status => 201 , :headers => { 'Location' => 'http://git.io/XXXXXX' } )
54 end
65
7- it "should return a shortened version of the URL" do
8- Gist . gist ( "Test gist" , :output => :short_url , :anonymous => true ) . should == "http://git.io/XXXXXX"
6+ it "should return a shortened version of the URL when response is 200" do
7+ stub_request ( :post , "https://git.io/create" ) . to_return ( :status => 200 , :body => 'XXXXXX' )
8+ Gist . gist ( "Test gist" , :output => :short_url , :anonymous => true ) . should == "https://git.io/XXXXXX"
99 end
10- end
1110
11+ it "should return a shortened version of the URL when response is 201" do
12+ stub_request ( :post , "https://git.io/create" ) . to_return ( :status => 201 , :headers => { 'Location' => 'https://git.io/XXXXXX' } )
13+ Gist . gist ( "Test gist" , :output => :short_url , :anonymous => true ) . should == "https://git.io/XXXXXX"
14+ end
15+ end
You can’t perform that action at this time.
0 commit comments