File tree Expand file tree Collapse file tree
lib/github_api/client/activity
spec/github/client/activity/starring Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33module Github
44 # Repository Starring is a feature that lets users bookmark repositories.
5- # Stars are shown next to repositories to show an approximate level of interest. # Stars have no effect on notifications or the activity feed.
5+ # Stars are shown next to repositories to show an approximate level of interest.
6+ # Stars have no effect on notifications or the activity feed.
67 class Client ::Activity ::Starring < API
78 # List stargazers
89 #
@@ -21,7 +22,7 @@ def list(*args)
2122 return response unless block_given?
2223 response . each { |el | yield el }
2324 end
24- alias :all :list
25+ alias_method :all , :list
2526
2627 # List repos being starred by a user
2728 #
@@ -54,15 +55,14 @@ def starred(*args)
5455 response = if ( user_name = params . delete ( 'user' ) )
5556 get_request ( "/users/#{ user_name } /starred" , params )
5657 else
57- get_request ( " /user/starred" , params )
58+ get_request ( ' /user/starred' , params )
5859 end
5960 return response unless block_given?
6061 response . each { |el | yield el }
6162 end
6263
6364 # Check if you are starring a repository
6465 #
65- #
6666 # @see https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository
6767 #
6868 # @example
Original file line number Diff line number Diff line change 2929 it "should yield iterator if block given" do
3030 yielded = [ ]
3131 result = subject . list ( user , repo ) { |obj | yielded << obj }
32- yielded . should == result
32+ expect ( yielded ) . to eq ( result )
3333 end
3434
3535 it "should get the resources" do
3636 subject . list user , repo
37- a_get ( request_path ) . should have_been_made
37+ expect ( a_get ( request_path ) ) . to have_been_made
3838 end
3939
4040 it_should_behave_like 'an array of resources' do
4343
4444 it "should get watcher information" do
4545 stargazers = subject . list user , repo
46- stargazers . first . login . should == 'octocat'
46+ expect ( stargazers . first . login ) . to eq ( 'octocat' )
4747 end
4848 end
4949
Original file line number Diff line number Diff line change 1919
2020 it "should successfully star a repo" do
2121 subject . star user , repo
22- a_put ( request_path ) . with ( :query => { :access_token => OAUTH_TOKEN } ) .
23- should have_been_made
22+ expect ( a_put ( request_path ) . with ( :query => { :access_token => OAUTH_TOKEN } ) ) .
23+ to have_been_made
2424 end
2525 end
2626 end
Original file line number Diff line number Diff line change 1919 stub_get ( "/users/#{ user } /starred" ) .
2020 to_return ( :body => fixture ( "repos/starred.json" ) , :status => 200 , :headers => { } )
2121 subject . starred :user => user
22- a_get ( "/users/#{ user } /starred" ) . should have_been_made
22+ expect ( a_get ( "/users/#{ user } /starred" ) ) . to have_been_made
2323 end
2424 end
2525
3434
3535 it "should get the resources" do
3636 subject . starred
37- a_get ( "/user/starred" ) . with ( :query => { :access_token => OAUTH_TOKEN } ) .
38- should have_been_made
37+ expect ( a_get ( "/user/starred" ) . with ( :query => { :access_token => OAUTH_TOKEN } ) ) .
38+ to have_been_made
3939 end
4040
4141 it "should return array of resources" do
4242 starred = subject . starred
43- starred . should be_an Enumerable
44- starred . should have ( 1 ) . items
43+ expect ( starred ) . to be_an Enumerable
44+ expect ( starred . size ) . to eq ( 1 )
4545 end
4646
4747 it "should get starred information" do
4848 starred = subject . starred
49- starred . first . name . should == 'Hello-World'
50- starred . first . owner . login . should == 'octocat'
49+ expect ( starred . first . name ) . to eq ( 'Hello-World' )
50+ expect ( starred . first . owner . login ) . to eq ( 'octocat' )
5151 end
5252 end
5353end # starred
Original file line number Diff line number Diff line change 1919
2020 it "should return false if resource not found" do
2121 starring = subject . starring? user , repo
22- starring . should be_false
22+ expect ( starring ) . to be_false
2323 end
2424
2525 it "should return true if resoure found" do
2626 stub_get ( request_path ) . to_return ( :body => "[]" , :status => 200 ,
2727 :headers => { :user_agent => subject . user_agent } )
2828 starring = subject . starring? user , repo
29- starring . should be_true
29+ expect ( starring ) . to be_true
3030 end
3131 end
3232
Original file line number Diff line number Diff line change 2020
2121 it "should successfully unstar a repo" do
2222 subject . unstar user , repo
23- a_delete ( request_path ) . with ( :query => { :access_token => OAUTH_TOKEN } ) .
24- should have_been_made
23+ expect ( a_delete ( request_path ) . with ( :query => { :access_token => OAUTH_TOKEN } ) ) .
24+ to have_been_made
2525 end
2626 end
2727 end
You can’t perform that action at this time.
0 commit comments