Skip to content

Commit e27b096

Browse files
committed
Change spec to new syntax.
1 parent 940b11a commit e27b096

6 files changed

Lines changed: 20 additions & 20 deletions

File tree

lib/github_api/client/activity/starring.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
module 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

spec/github/client/activity/starring/list_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
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
@@ -43,7 +43,7 @@
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

spec/github/client/activity/starring/star_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
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

spec/github/client/activity/starring/starred_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
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

@@ -34,20 +34,20 @@
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
5353
end # starred

spec/github/client/activity/starring/starring_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
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

spec/github/client/activity/starring/unstar_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
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

0 commit comments

Comments
 (0)