forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiple_invocations_spec.rb
More file actions
42 lines (32 loc) · 1.11 KB
/
multiple_invocations_spec.rb
File metadata and controls
42 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# encoding: utf-8
require 'spec_helper'
describe Github, 'invocations' do
context 'repo commits with sha' do
let(:user) { "peter-murach" }
let(:repo) { "github" }
let(:sha) { "ceb66b61264657898cd6608c7e9ed78072169664" }
let(:request_path) { "/repos/#{user}/#{repo}/commits/#{sha}" }
before {
stub_get(request_path).to_return(:body => '{}', :status => 200,
:headers => {:content_type => "application/json; charset=utf-8"})
}
it 'requests commit information twice' do
subject.repos.commits.get user, repo, sha
subject.repos.commits.get user, repo, sha
a_get(request_path).should have_been_made.times(2)
end
end
context 'organization info' do
let(:org) { "thoughtbot" }
let(:request_path) { "/orgs/#{org}" }
before {
stub_get(request_path).to_return(:body => '{}', :status => 200,
:headers => {:content_type => "application/json; charset=utf-8"})
}
it 'requests organization information twice' do
subject.orgs.get org
subject.orgs.get org
a_get(request_path).should have_been_made.times(2)
end
end
end