Skip to content

Commit 5d2b8b8

Browse files
Add spec for Feed API #list
1 parent f3c1970 commit 5d2b8b8

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# encoding: utf-8
2+
3+
require 'spec_helper'
4+
5+
describe Github::Client::Activity::Feeds, '#list' do
6+
let(:user) { 'peter-murach' }
7+
let(:repo) { 'github' }
8+
9+
before { subject.oauth_token = OAUTH_TOKEN }
10+
11+
after { reset_authentication_for subject }
12+
13+
context 'resource found for authenticated user' do
14+
let(:request_path) { "/feeds" }
15+
let(:body) { fixture('activity/feeds.json') }
16+
let(:status) { 200 }
17+
18+
before {
19+
stub_get(request_path).with(:query => {:access_token => OAUTH_TOKEN }).
20+
to_return(:body => body, :status => status,
21+
:headers => {:content_type => "application/json; charset=utf-8"})
22+
}
23+
24+
it { should respond_to :all }
25+
26+
it 'should get the resource' do
27+
subject.list
28+
a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
29+
should have_been_made
30+
end
31+
32+
it "should get timeline url" do
33+
feeds = subject.list
34+
feeds.timeline_url.should == 'https://github.com/timeline'
35+
end
36+
37+
it "should get user url" do
38+
feeds = subject.list
39+
feeds.user_url.should == 'https://github.com/{user}'
40+
end
41+
42+
it "should get current user public url" do
43+
feeds = subject.list
44+
feeds.current_user_public_url.should == 'https://github.com/defunkt'
45+
end
46+
47+
it "should get current user url" do
48+
feeds = subject.list
49+
feeds.current_user_url.should == 'https://github.com/defunkt.private?token=abc123'
50+
end
51+
52+
it "should get current user actor url" do
53+
feeds = subject.list
54+
feeds.current_user_actor_url.should == 'https://github.com/defunkt.private.actor?token=abc123'
55+
end
56+
57+
it "should get current user organization url" do
58+
feeds = subject.list
59+
feeds.current_user_organization_url.should == ''
60+
end
61+
62+
it "should get current user public url" do
63+
feeds = subject.list
64+
feeds.current_user_organization_urls.first.should == 'https://github.com/organizations/github/defunkt.private.atom?token=abc123'
65+
end
66+
67+
it_should_behave_like 'request failure' do
68+
let(:requestable) { subject.list }
69+
end
70+
end
71+
72+
end

0 commit comments

Comments
 (0)