File tree Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ def multi_gist(files, options={})
127
127
128
128
existing_gist = options [ :update ] . to_s . split ( "/" ) . last
129
129
if options [ :anonymous ]
130
- access_token = nil
130
+ raise 'Anonymous gist support has been removed by Github. ' \
131
+ 'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
131
132
else
132
133
access_token = ( options [ :access_token ] || auth_token ( ) )
133
134
end
Original file line number Diff line number Diff line change 6
6
end
7
7
8
8
it "should return the raw file url" do
9
- Gist . gist ( "Test gist" , :output => :raw_url , :anonymous => true ) . should == "https://gist.github.com/anonymous/XXXXXX/raw"
9
+ Gist . gist ( "Test gist" , :output => :raw_url , :anonymous => false ) . should == "https://gist.github.com/anonymous/XXXXXX/raw"
10
+ end
11
+
12
+ it 'should raise an error when trying to do operations without being logged in' do
13
+ error_msg = 'Anonymous gist support has been removed by Github. ' \
14
+ 'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
15
+
16
+ expect do
17
+ Gist . gist ( "Test gist" , output : :raw_url , anonymous : true )
18
+ end . to raise_error ( StandardError , error_msg )
10
19
end
11
20
end
12
21
Original file line number Diff line number Diff line change 5
5
6
6
it "should return a shortened version of the URL when response is 200" do
7
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"
8
+ Gist . gist ( "Test gist" , :output => :short_url , anonymous : false ) . should == "https://git.io/XXXXXX"
9
9
end
10
10
11
11
it "should return a shortened version of the URL when response is 201" do
12
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"
13
+ Gist . gist ( "Test gist" , :output => :short_url , anonymous : false ) . should == "https://git.io/XXXXXX"
14
+ end
15
+
16
+ it 'should raise an error when trying to get short urls without being logged in' do
17
+ error_msg = 'Anonymous gist support has been removed by Github. ' \
18
+ 'See: https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/'
19
+
20
+ expect do
21
+ Gist . gist ( "Test gist" , output : :short_url , anonymous : true )
22
+ end . to raise_error ( StandardError , error_msg )
14
23
end
15
24
end
Original file line number Diff line number Diff line change 11
11
mocks . syntax = :should
12
12
end
13
13
config . expect_with :rspec do |expectations |
14
- expectations . syntax = :should
14
+ expectations . syntax = [ :should , :expect ]
15
15
end
16
16
end
17
17
You can’t perform that action at this time.
0 commit comments