githubris 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  class Githubris
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -29,9 +29,25 @@ describe Githubris::Gist do
29
29
  describe '#save' do
30
30
  use_vcr_cassette
31
31
 
32
- it 'it must have be public or not, and it must have files' do
32
+ it 'for a public, anonymous gist' do
33
33
  gist = described_class.new :public => true, :files => {'gistfile.txt' => {:content => 'foobar'}}
34
34
  lambda { gist.save }.should_not raise_error
35
35
  end
36
+
37
+ context 'when authenticated' do
38
+ use_vcr_cassette
39
+
40
+ let(:api) { Githubris::API.new }
41
+
42
+ before do
43
+ api.basic_auth('GithubrisTestUser', 'password')
44
+ end
45
+
46
+ it 'for a gist by an authenticated user' do
47
+ gist = described_class.new :_api => api, :public => true, :files => {'gistfile.txt' => {:content => 'foobar'}}
48
+ lambda { gist.save }.should_not raise_error
49
+ gist.user.login.should == 'GithubrisTestUser'
50
+ end
51
+ end
36
52
  end
37
53
  end
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://GithubrisTestUser:password@api.github.com/gists
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"description":null,"public":true,"files":{"gistfile.txt":{"content":"foobar"}}}'
9
+ headers:
10
+ authorization:
11
+ - Basic BasicAuthCrap
12
+ connection:
13
+ - close
14
+ response:
15
+ status:
16
+ code: 201
17
+ message: Created
18
+ headers:
19
+ server:
20
+ - nginx/1.0.13
21
+ date:
22
+ - Wed, 11 Apr 2012 23:54:50 GMT
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ connection:
26
+ - close
27
+ status:
28
+ - 201 Created
29
+ x-ratelimit-limit:
30
+ - '5000'
31
+ etag:
32
+ - ! '"6522e05c85e3c096f40e672b1391559c"'
33
+ location:
34
+ - https://api.github.com/gists/2363568
35
+ x-ratelimit-remaining:
36
+ - '4999'
37
+ content-length:
38
+ - '1449'
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ! '{"git_pull_url":"git://gist.github.com/2363568.git","history":[{"user":{"gravatar_id":"20de3fd01e285d14de84067c34ab74d2","avatar_url":"https://secure.gravatar.com/avatar/20de3fd01e285d14de84067c34ab74d2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/GithubrisTestUser","id":1469392,"login":"GithubrisTestUser"},"url":"https://api.github.com/gists/2363568/9acf4ddd8d7843944be798eabb585588740a5189","version":"9acf4ddd8d7843944be798eabb585588740a5189","change_status":{"deletions":0,"total":1,"additions":1},"committed_at":"2012-04-11T23:54:50Z"}],"comments":0,"updated_at":"2012-04-11T23:54:49Z","git_push_url":"git@gist.github.com:2363568.git","forks":[],"public":true,"user":{"gravatar_id":"20de3fd01e285d14de84067c34ab74d2","avatar_url":"https://secure.gravatar.com/avatar/20de3fd01e285d14de84067c34ab74d2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/GithubrisTestUser","id":1469392,"login":"GithubrisTestUser"},"html_url":"https://gist.github.com/2363568","created_at":"2012-04-11T23:54:49Z","url":"https://api.github.com/gists/2363568","description":null,"id":"2363568","files":{"gistfile.txt":{"type":"text/plain","language":"Text","size":6,"raw_url":"https://gist.github.com/raw/2363568/f6ea0495187600e7b2288c8ac19c5886383a4632/gistfile.txt","filename":"gistfile.txt","content":"foobar"}}}'
42
+ http_version: '1.1'
43
+ recorded_at: Wed, 11 Apr 2012 23:54:50 GMT
44
+ recorded_with: VCR 2.0.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githubris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &9220560 !ruby/object:Gem::Requirement
16
+ requirement: &12734840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9220560
24
+ version_requirements: *12734840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: multi_json
27
- requirement: &9218880 !ruby/object:Gem::Requirement
27
+ requirement: &12733100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *9218880
35
+ version_requirements: *12733100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: addressable
38
- requirement: &9217820 !ruby/object:Gem::Requirement
38
+ requirement: &12732160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.2.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *9217820
46
+ version_requirements: *12732160
47
47
  description: Githubris is meant to make Github API interaction a breeze.
48
48
  email:
49
49
  - isaac@isaacbfsanders.com
@@ -98,6 +98,7 @@ files:
98
98
  - spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_authenticated_user/without_credentials.yml
99
99
  - spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_user.yml
100
100
  - spec/support/fixtures/vcr_cassettes/Githubris_Gist/_save.yml
101
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/_save/when_authenticated.yml
101
102
  - spec/support/fixtures/vcr_cassettes/Githubris_Gist/any_gist.yml
102
103
  - spec/support/fixtures/vcr_cassettes/Githubris_Gist/given_a_gist_full_of_data.yml
103
104
  - spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id.yml