github_api 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,4 +41,45 @@ http_interactions:
41
41
  string: ! '[]'
42
42
  http_version: !!null
43
43
  recorded_at: Mon, 07 May 2012 16:12:16 GMT
44
+ - request:
45
+ method: get
46
+ uri: https://<BASIC_AUTH>@api.github.com/gists?access_token=<TOKEN>
47
+ body:
48
+ encoding: US-ASCII
49
+ string: ''
50
+ headers:
51
+ Accept-Encoding:
52
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
53
+ Accept:
54
+ - ! '*/*'
55
+ User-Agent:
56
+ - Ruby
57
+ response:
58
+ status:
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ Server:
63
+ - nginx/1.0.13
64
+ Date:
65
+ - Wed, 16 May 2012 21:39:38 GMT
66
+ Content-Type:
67
+ - application/json; charset=utf-8
68
+ Connection:
69
+ - keep-alive
70
+ Status:
71
+ - 200 OK
72
+ Etag:
73
+ - ! '"d751713988987e9331980363e24189ce"'
74
+ X-Ratelimit-Limit:
75
+ - '5000'
76
+ X-Ratelimit-Remaining:
77
+ - '4999'
78
+ Content-Length:
79
+ - '2'
80
+ body:
81
+ encoding: US-ASCII
82
+ string: ! '[]'
83
+ http_version: !!null
84
+ recorded_at: Wed, 16 May 2012 21:39:39 GMT
44
85
  recorded_with: VCR 2.1.1
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://<BASIC_AUTH>@api.github.com/user/emails?access_token=<TOKEN>
6
+ body:
7
+ encoding: UTF-8
8
+ string: "[\"octocat@example.com\",\"terry@example.com\"]"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - nginx/1.0.13
23
+ Date:
24
+ - Sun, 20 May 2012 10:32:18 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Connection:
28
+ - keep-alive
29
+ Status:
30
+ - 201 Created
31
+ X-Ratelimit-Limit:
32
+ - "5000"
33
+ Etag:
34
+ - "\"0abdbd0947127ead3e9b00aef1c145b1\""
35
+ X-Ratelimit-Remaining:
36
+ - "4990"
37
+ Content-Length:
38
+ - "59"
39
+ body:
40
+ encoding: US-ASCII
41
+ string: "[\"octocat@example.com\",\"terry@example.com\",\"<EMAIL>\"]"
42
+ http_version:
43
+ recorded_at: Sun, 20 May 2012 10:32:18 GMT
44
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://<BASIC_AUTH>@api.github.com/user/emails?access_token=<TOKEN>
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.0.13
23
+ Date:
24
+ - Sun, 20 May 2012 09:53:28 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Connection:
28
+ - keep-alive
29
+ Status:
30
+ - 200 OK
31
+ X-Ratelimit-Limit:
32
+ - "5000"
33
+ Etag:
34
+ - "\"e411c2596673397775541ed7eb41a3cc\""
35
+ X-Ratelimit-Remaining:
36
+ - "4995"
37
+ Content-Length:
38
+ - "17"
39
+ body:
40
+ encoding: US-ASCII
41
+ string: "[\"<EMAIL>\"]"
42
+ http_version:
43
+ recorded_at: Sun, 20 May 2012 09:53:28 GMT
44
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://<BASIC_AUTH>@api.github.com/user/emails?access_token=<TOKEN>
6
+ body:
7
+ encoding: UTF-8
8
+ string: "[\"octocat@example.com\"]"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Server:
22
+ - nginx/1.0.13
23
+ Date:
24
+ - Sun, 20 May 2012 12:28:56 GMT
25
+ Connection:
26
+ - keep-alive
27
+ Status:
28
+ - 204 No Content
29
+ X-Ratelimit-Limit:
30
+ - "5000"
31
+ Etag:
32
+ - "\"d41d8cd98f00b204e9800998ecf8427e\""
33
+ X-Ratelimit-Remaining:
34
+ - "4998"
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ""
38
+ http_version:
39
+ recorded_at: Sun, 20 May 2012 12:28:56 GMT
40
+ recorded_with: VCR 2.1.1
@@ -7,34 +7,31 @@ Feature: Accessing Gists Main API
7
7
  Given I have "Github::Gists" instance
8
8
 
9
9
  Scenario: Lists all user's gists
10
- When I want to list resources with the following params:
11
- | user |
12
- | peter-murach |
13
- And I make request within a cassette named "gists/gists/user_all"
14
- Then the response should be "200"
15
- And the response type should be "JSON"
10
+ Given I want to list resources
11
+ And I pass the following request options:
12
+ | user |
13
+ | peter-murach |
14
+ When I make request within a cassette named "gists/gists/user_all"
15
+ Then the response status should be 200
16
+ And the response type should be JSON
16
17
 
17
18
  Scenario: Lists all public gists
18
- When I want to list resources with the following params:
19
- | user |
20
- | nil |
21
- And I make request within a cassette named "gists/gists/public_all"
22
- Then the response should be "200"
23
- And the response type should be "JSON"
19
+ Given I want to list resources
20
+ When I make request within a cassette named "gists/gists/public_all"
21
+ Then the response status should be 200
22
+ And the response type should be JSON
24
23
 
25
24
  Scenario: Gets a single gist
26
- When I want to get resource with the following params:
25
+ Given I want to get resource with the following params:
27
26
  | gist_id |
28
27
  | 1738161 |
29
- And I make request within a cassette named "gists/gist"
30
- Then the response should be "200"
31
- And the response type should be "JSON"
28
+ When I make request within a cassette named "gists/gist"
29
+ Then the response status should be 200
30
+ And the response type should be JSON
32
31
 
33
32
  Scenario: Check if gist is starred
34
- When I want to starred? resource with the following params:
33
+ Given I want to starred? resource with the following params:
35
34
  | gist_id |
36
35
  | 1738161 |
37
- And I make request within a cassette named "gists/starred"
36
+ When I make request within a cassette named "gists/starred"
38
37
  Then the response should equal false
39
-
40
-
@@ -11,8 +11,8 @@ Feature: Accessing Gists Comments API
11
11
  | gist_id |
12
12
  | 999390 |
13
13
  And I make request within a cassette named "gists/comments/all"
14
- Then the response should be "200"
15
- And the response type should be "JSON"
14
+ Then the response status should be 200
15
+ And the response type should be JSON
16
16
  And the response should have 18 items
17
17
 
18
18
  Scenario: Gets a single gist's comment
@@ -20,6 +20,6 @@ Feature: Accessing Gists Comments API
20
20
  | comment_id |
21
21
  | 33469 |
22
22
  And I make request within a cassette named "gists/comments/first"
23
- Then the response should be "200"
24
- And the response type should be "JSON"
23
+ Then the response status should be 200
24
+ And the response type should be JSON
25
25
  And the response should not be empty
@@ -12,8 +12,8 @@ Feature: Accessing GitData References API
12
12
  | user | repo |
13
13
  | wycats | thor |
14
14
  When I make request within a cassette named "git_data/references/all"
15
- Then the response should be "200"
16
- And the response type should be "JSON"
15
+ Then the response status should be 200
16
+ And the response type should be JSON
17
17
  And the response should not be empty
18
18
 
19
19
  Scenario: Lists all references on a repository scoped by branch
@@ -24,8 +24,8 @@ Feature: Accessing GitData References API
24
24
  | ref |
25
25
  | tags |
26
26
  When I make request within a cassette named "git_data/references/all_tags"
27
- Then the response should be "200"
28
- And the response type should be "JSON"
27
+ Then the response status should be 200
28
+ And the response type should be JSON
29
29
  And the response should not be empty
30
30
 
31
31
  Scenario: Gets a single reference
@@ -33,8 +33,8 @@ Feature: Accessing GitData References API
33
33
  | user | repo | ref |
34
34
  | wycats | thor | heads/gh-pages |
35
35
  When I make request within a cassette named "git_data/references/one"
36
- Then the response should be "200"
37
- And the response type should be "JSON"
36
+ Then the response status should be 200
37
+ And the response type should be JSON
38
38
  And the response should not be empty
39
39
 
40
40
  # Scenario: Create a reference
@@ -10,12 +10,12 @@ Feature: Githu API pagination
10
10
  | user | per_page |
11
11
  | wycats | 45 |
12
12
  And I make request within a cassette named "pagination/repos/list"
13
- Then the response should be "200"
14
- And the response type should be "JSON"
13
+ Then the response status should be 200
14
+ And the response type should be JSON
15
15
  And the response should have 45 items
16
16
 
17
17
  When I request "next" page within a cassette named "pagination/repos/list/next"
18
- Then the response should be "200"
18
+ Then the response status should be 200
19
19
  And the response should have 45 items
20
20
 
21
21
  Scenario: Returned paginated resources are different
@@ -25,12 +25,12 @@ Feature: Githu API pagination
25
25
  | user |
26
26
  | wycats |
27
27
  And I make request within a cassette named "pagination/repos/diff"
28
- Then the response should be "200"
29
- And the response type should be "JSON"
28
+ Then the response status should be 200
29
+ And the response type should be JSON
30
30
  And the response should have 30 items
31
31
 
32
32
  When I request "next" page within a cassette named "pagination/repos/diff/next"
33
- Then the response should be "200"
33
+ Then the response status should be 200
34
34
  And the response should have 30 items
35
35
  And the response collection of resources is different for "name" attribute
36
36
 
@@ -43,12 +43,12 @@ Feature: Githu API pagination
43
43
  | per_page |
44
44
  | 45 |
45
45
  And I make request within a cassette named "pagination/repos/commits/list"
46
- Then the response should be "200"
47
- And the response type should be "JSON"
46
+ Then the response status should be 200
47
+ And the response type should be JSON
48
48
  And the response should have 45 items
49
49
 
50
50
  When I request "next" page within a cassette named "pagination/repos/commits/next"
51
- Then the response should be "200"
51
+ Then the response status should be 200
52
52
  And the response should have 45 items
53
53
 
54
54
  Scenario: Calling 'list' for Github::Repos::Commits returns different collections
@@ -57,11 +57,11 @@ Feature: Githu API pagination
57
57
  | user | repo |
58
58
  | peter-murach | github |
59
59
  And I make request within a cassette named "pagination/repos/commits/sha"
60
- Then the response should be "200"
60
+ Then the response status should be 200
61
61
  And the response should have 30 items
62
62
 
63
63
  When I request "next" page within a cassette named "pagination/repos/commits/sha/next"
64
- Then the response should be "200"
64
+ Then the response status should be 200
65
65
  And the response should have 30 items
66
66
  And the response collection of resources is different for "sha" attribute
67
67
 
@@ -72,7 +72,7 @@ Feature: Githu API pagination
72
72
  | user |
73
73
  | wycats |
74
74
  And I make request within a cassette named "pagination/repos/per_page/first"
75
- Then the response should be "200"
75
+ Then the response status should be 200
76
76
  When I iterate through collection pages within a cassette named "pagination/repos/per_page/each_page"
77
77
  Then this collection should include first page
78
78
 
@@ -11,8 +11,8 @@ Feature: Accessing Repos Main API
11
11
  | user | repo |
12
12
  | peter-murach | github |
13
13
  And I make request within a cassette named "repos/branches"
14
- Then the response should be "200"
15
- And the response type should be "JSON"
14
+ Then the response status should be 200
15
+ And the response type should be JSON
16
16
  And the response should not be empty
17
17
 
18
18
  Scenario: Returning all repository tags
@@ -20,8 +20,8 @@ Feature: Accessing Repos Main API
20
20
  | user | repo |
21
21
  | peter-murach | github |
22
22
  And I make request within a cassette named "repos/tags"
23
- Then the response should be "200"
24
- And the response type should be "JSON"
23
+ Then the response status should be 200
24
+ And the response type should be JSON
25
25
  And the response should not be empty
26
26
 
27
27
  Scenario: Returning all repositories for the user
@@ -30,8 +30,8 @@ Feature: Accessing Repos Main API
30
30
  | user |
31
31
  | peter-murach |
32
32
  When I make request within a cassette named "repos/list"
33
- Then the response should be "200"
34
- And the response type should be "JSON"
33
+ Then the response status should be 200
34
+ And the response type should be JSON
35
35
  And the response should not be empty
36
36
 
37
37
  Scenario: Get a repository
@@ -39,8 +39,8 @@ Feature: Accessing Repos Main API
39
39
  | user | repo |
40
40
  | wycats | thor |
41
41
  When I make request within a cassette named "repos/get"
42
- Then the response should be "200"
43
- And the response type should be "JSON"
42
+ Then the response status should be 200
43
+ And the response type should be JSON
44
44
  And the response should not be empty
45
45
 
46
46
  Scenario: Listing repository languages
@@ -48,8 +48,8 @@ Feature: Accessing Repos Main API
48
48
  | user | repo |
49
49
  | peter-murach | github |
50
50
  And I make request within a cassette named "repos/languages"
51
- Then the response should be "200"
52
- And the response type should be "JSON"
51
+ Then the response status should be 200
52
+ And the response type should be JSON
53
53
 
54
54
  Scenario: Create repository
55
55
  Given I want to create resource
@@ -57,6 +57,6 @@ Feature: Accessing Repos Main API
57
57
  | name |
58
58
  | github_api_test |
59
59
  When I make request within a cassette named "repos/create"
60
- Then the response should be "201"
61
- And the response type should be "JSON"
60
+ Then the response status should be 201
61
+ And the response type should be JSON
62
62
  And the response should not be empty
@@ -4,3 +4,4 @@ basic_auth: murek:Testing123
4
4
  user: murek
5
5
  repo: github_api_test
6
6
  org:
7
+ email: p_murek@wp.pl
@@ -4,3 +4,4 @@ basic_auth: login:password
4
4
  user: username
5
5
  repo: repository name
6
6
  org: organisation this user belongs to
7
+ email: username@example.com
@@ -6,10 +6,6 @@ When /^(.*) within a cassette named "([^"]*)"$/ do |step_to_call, cassette_name|
6
6
  VCR.use_cassette(cassette_name) { step step_to_call }
7
7
  end
8
8
 
9
- Then /^the response should be "([^"]*)"$/ do |expected_response|
10
- @response.status.should eql expected_response.to_i
11
- end
12
-
13
9
  Then /^the response should equal (.*)$/ do |expected_response|
14
10
  expected = case expected_response
15
11
  when /t/
@@ -22,7 +18,11 @@ Then /^the response should equal (.*)$/ do |expected_response|
22
18
  @response.should == expected
23
19
  end
24
20
 
25
- Then /^the response type should be "([^"]*)"$/ do |type|
21
+ Then /^the response status should be (.*)$/ do |expected_response|
22
+ @response.status.should eql expected_response.to_i
23
+ end
24
+
25
+ Then /^the response type should be (.*)$/ do |type|
26
26
  @response.content_type.should =~ /application\/#{type.downcase}/
27
27
  end
28
28
 
@@ -33,3 +33,10 @@ end
33
33
  Then /^the response should not be empty$/ do
34
34
  @response.should_not be_empty
35
35
  end
36
+
37
+ Then /^the response should contain (.*)$/ do |item|
38
+ case @response.body
39
+ when Array
40
+ @response.body.should include item
41
+ end
42
+ end