Skip to content

Commit 2aa83a9

Browse files
author
Sam Davies
committed
Add unit specs for Projects Columns API
1 parent f2c9f51 commit 2aa83a9

18 files changed

Lines changed: 306 additions & 9 deletions

File tree

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Style/StringLiterals:
22
Enabled: false
33

4+
Metrics/BlockLength:
5+
Enabled: false
6+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"post","uri":"https://api.github.com/projects/524103/columns?access_token=<TOKEN>","body":{"encoding":"UTF-8","base64_string":"eyJuYW1lIjoiTmV3IGNvbHVtbiJ9\n"},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Content-Type":["application/json"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":201,"message":"Created"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:52:37 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["282"],"Status":["201 Created"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4963"],"X-Ratelimit-Reset":["1491901158"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["\"e0345078cdbe9ebad2645071503b0d0c\""],"Location":["https://api.github.com/projects/columns/895044"],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["9000e9eef7bb1e89f22030c676da140e"],"X-Github-Request-Id":["EE1F:69BF:868AEE:AA6CA8:58EC9954"]},"body":{"encoding":"UTF-8","base64_string":"eyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3Byb2plY3RzL2NvbHVt\nbnMvODk1MDQ0IiwicHJvamVjdF91cmwiOiJodHRwczovL2FwaS5naXRodWIu\nY29tL3Byb2plY3RzLzUyNDEwMyIsImNhcmRzX3VybCI6Imh0dHBzOi8vYXBp\nLmdpdGh1Yi5jb20vcHJvamVjdHMvY29sdW1ucy84OTUwNDQvY2FyZHMiLCJp\nZCI6ODk1MDQ0LCJuYW1lIjoiTmV3IGNvbHVtbiIsImNyZWF0ZWRfYXQiOiIy\nMDE3LTA0LTExVDA4OjUyOjM2WiIsInVwZGF0ZWRfYXQiOiIyMDE3LTA0LTEx\nVDA4OjUyOjM2WiJ9\n"},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:52:37 GMT"}],"recorded_with":"VCR 3.0.3"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"delete","uri":"https://api.github.com/projects/columns/895044?access_token=<TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":204,"message":"No Content"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:54:12 GMT"],"Status":["204 No Content"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4959"],"X-Ratelimit-Reset":["1491901158"],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"Vary":["Accept-Encoding"],"X-Served-By":["b535085e7f4d6e3423e016e684de0829"],"X-Github-Request-Id":["EF6A:69BF:86D037:AAC464:58EC99B4"]},"body":{"encoding":"UTF-8","base64_string":""},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:54:12 GMT"}],"recorded_with":"VCR 3.0.3"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/projects/columns/887705?access_token=<TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:52:12 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["200 OK"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4964"],"X-Ratelimit-Reset":["1491901158"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["W/\"4b121b392daf8a3ec6d11020f189eff0\""],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["77fbfb53269bbb85f82f23584d59f7c1"],"X-Github-Request-Id":["EDCD:69BF:86796C:AA5636:58EC993C"]},"body":{"encoding":"ASCII-8BIT","base64_string":"eyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3Byb2plY3RzL2NvbHVt\nbnMvODg3NzA1IiwicHJvamVjdF91cmwiOiJodHRwczovL2FwaS5naXRodWIu\nY29tL3Byb2plY3RzLzUyNDEwMyIsImNhcmRzX3VybCI6Imh0dHBzOi8vYXBp\nLmdpdGh1Yi5jb20vcHJvamVjdHMvY29sdW1ucy84ODc3MDUvY2FyZHMiLCJp\nZCI6ODg3NzA1LCJuYW1lIjoiVG8gZG8iLCJjcmVhdGVkX2F0IjoiMjAxNy0w\nNC0wOVQxNzozMTo1OVoiLCJ1cGRhdGVkX2F0IjoiMjAxNy0wNC0wOVQxNzoz\nMjoyNloifQ==\n"},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:52:12 GMT"}],"recorded_with":"VCR 3.0.3"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/projects/524103/columns?access_token=<TOKEN>","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:50:11 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["200 OK"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4967"],"X-Ratelimit-Reset":["1491901158"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["W/\"d07c69a8aa8426cebf804b8e149999ad\""],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["07ff1c8a09e44b62e277fae50a1b1dc4"],"X-Github-Request-Id":["EB92:69C4:792643:999500:58EC98C2"]},"body":{"encoding":"ASCII-8BIT","base64_string":"W3sidXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9wcm9qZWN0cy9jb2x1\nbW5zLzg4NzcwNSIsInByb2plY3RfdXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHVi\nLmNvbS9wcm9qZWN0cy81MjQxMDMiLCJjYXJkc191cmwiOiJodHRwczovL2Fw\naS5naXRodWIuY29tL3Byb2plY3RzL2NvbHVtbnMvODg3NzA1L2NhcmRzIiwi\naWQiOjg4NzcwNSwibmFtZSI6IlRvIGRvIiwiY3JlYXRlZF9hdCI6IjIwMTct\nMDQtMDlUMTc6MzE6NTlaIiwidXBkYXRlZF9hdCI6IjIwMTctMDQtMDlUMTc6\nMzI6MjZaIn0seyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3Byb2pl\nY3RzL2NvbHVtbnMvODg3NzA2IiwicHJvamVjdF91cmwiOiJodHRwczovL2Fw\naS5naXRodWIuY29tL3Byb2plY3RzLzUyNDEwMyIsImNhcmRzX3VybCI6Imh0\ndHBzOi8vYXBpLmdpdGh1Yi5jb20vcHJvamVjdHMvY29sdW1ucy84ODc3MDYv\nY2FyZHMiLCJpZCI6ODg3NzA2LCJuYW1lIjoiRG9pbmciLCJjcmVhdGVkX2F0\nIjoiMjAxNy0wNC0wOVQxNzozMjowM1oiLCJ1cGRhdGVkX2F0IjoiMjAxNy0w\nNC0wOVQxNzozMjowM1oifSx7InVybCI6Imh0dHBzOi8vYXBpLmdpdGh1Yi5j\nb20vcHJvamVjdHMvY29sdW1ucy84ODc3MDgiLCJwcm9qZWN0X3VybCI6Imh0\ndHBzOi8vYXBpLmdpdGh1Yi5jb20vcHJvamVjdHMvNTI0MTAzIiwiY2FyZHNf\ndXJsIjoiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9wcm9qZWN0cy9jb2x1bW5z\nLzg4NzcwOC9jYXJkcyIsImlkIjo4ODc3MDgsIm5hbWUiOiJEb25lIiwiY3Jl\nYXRlZF9hdCI6IjIwMTctMDQtMDlUMTc6MzI6MDZaIiwidXBkYXRlZF9hdCI6\nIjIwMTctMDQtMDlUMTc6MzI6MDZaIn1d\n"},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:50:11 GMT"}],"recorded_with":"VCR 3.0.3"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"post","uri":"https://api.github.com/projects/columns/887706/moves?access_token=<TOKEN>","body":{"encoding":"UTF-8","base64_string":"eyJwb3NpdGlvbiI6ImFmdGVyOjg4NzcwOCJ9\n"},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Content-Type":["application/json"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":201,"message":"Created"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:53:15 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["2"],"Status":["201 Created"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4961"],"X-Ratelimit-Reset":["1491901158"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["\"feaaea8e5636af33263299f89d3e96ce\""],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["6694d697f15dfc31f0ffaf8cdb1d5a86"],"X-Github-Request-Id":["EE99:69BE:3DD03D:4E4B1B:58EC997A"]},"body":{"encoding":"UTF-8","base64_string":"e30=\n"},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:53:15 GMT"}],"recorded_with":"VCR 3.0.3"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions":[{"request":{"method":"patch","uri":"https://api.github.com/projects/columns/887705?access_token=<TOKEN>","body":{"encoding":"UTF-8","base64_string":"eyJuYW1lIjoiVG8gRG8ifQ==\n"},"headers":{"Accept":["application/vnd.github.inertia-preview+json"],"Accept-Charset":["utf-8"],"User-Agent":["Github API Ruby Gem 0.16.0"],"Content-Type":["application/json"],"Authorization":["Basic c2FtcGhpbGlwZDpVZFVmUWZyeVVqcjlqSFlKTnBrR2dvM1A2OWpkYzY=\""],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Tue, 11 Apr 2017 08:52:42 GMT"],"Content-Type":["application/json; charset=utf-8"],"Transfer-Encoding":["chunked"],"Status":["200 OK"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4962"],"X-Ratelimit-Reset":["1491901158"],"Cache-Control":["private, max-age=60, s-maxage=60"],"Vary":["Accept, Authorization, Cookie, X-GitHub-OTP","Accept-Encoding"],"Etag":["W/\"e660325333eb8cf1227b08e86393636a\""],"X-Github-Media-Type":["github.inertia-preview; format=json"],"Access-Control-Expose-Headers":["ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"],"Access-Control-Allow-Origin":["*"],"Content-Security-Policy":["default-src 'none'"],"Strict-Transport-Security":["max-age=31536000; includeSubdomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["deny"],"X-Xss-Protection":["1; mode=block"],"X-Served-By":["46808ddc41c302090177e58148908b23"],"X-Github-Request-Id":["EE35:69C4:7992F3:9A1EDB:58EC995A"]},"body":{"encoding":"ASCII-8BIT","base64_string":"eyJ1cmwiOiJodHRwczovL2FwaS5naXRodWIuY29tL3Byb2plY3RzL2NvbHVt\nbnMvODg3NzA1IiwicHJvamVjdF91cmwiOiJodHRwczovL2FwaS5naXRodWIu\nY29tL3Byb2plY3RzLzUyNDEwMyIsImNhcmRzX3VybCI6Imh0dHBzOi8vYXBp\nLmdpdGh1Yi5jb20vcHJvamVjdHMvY29sdW1ucy84ODc3MDUvY2FyZHMiLCJp\nZCI6ODg3NzA1LCJuYW1lIjoiVG8gRG8iLCJjcmVhdGVkX2F0IjoiMjAxNy0w\nNC0wOVQxNzozMTo1OVoiLCJ1cGRhdGVkX2F0IjoiMjAxNy0wNC0xMVQwODo1\nMjo0MloifQ==\n"},"http_version":null},"recorded_at":"Tue, 11 Apr 2017 08:52:42 GMT"}],"recorded_with":"VCR 3.0.3"}

features/projects/columns.feature

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: Projects Columns API
77

88
Given I want to list resource with the following params:
99
| project_id |
10-
| 525658 |
10+
| 524103 |
1111
When I make request within a cassette named "projects/columns/list"
1212
Then the response status should be 200
1313
And the response type should be JSON
@@ -17,7 +17,7 @@ Feature: Projects Columns API
1717

1818
Given I want to get resource with the following params:
1919
| column_id |
20-
| 890044 |
20+
| 887705 |
2121
When I make request within a cassette named "projects/columns/get"
2222
Then the response status should be 200
2323
And the response type should be JSON
@@ -27,7 +27,7 @@ Feature: Projects Columns API
2727

2828
Given I want to create resource with the following params:
2929
| project_id |
30-
| 525658 |
30+
| 524103 |
3131
And I pass the following request options:
3232
| name |
3333
| New column |
@@ -40,10 +40,10 @@ Feature: Projects Columns API
4040

4141
Given I want to update resource with the following params:
4242
| column_id |
43-
| 890044 |
43+
| 887705 |
4444
And I pass the following request options:
4545
| name |
46-
| Updated name |
46+
| To Do |
4747
When I make request within a cassette named "projects/columns/update"
4848
Then the response status should be 200
4949
And the response type should be JSON
@@ -53,10 +53,10 @@ Feature: Projects Columns API
5353

5454
Given I want to move resource with the following params:
5555
| column_id |
56-
| 890044 |
56+
| 887706 |
5757
And I pass the following request options:
5858
| position |
59-
| after:890048 |
59+
| after:887708 |
6060
When I make request within a cassette named "projects/columns/move"
6161
Then the response status should be 201
6262
And the response type should be JSON
@@ -66,7 +66,7 @@ Feature: Projects Columns API
6666

6767
Given I want to delete resource with the following params:
6868
| column_id |
69-
| 890044 |
69+
| 895044 |
7070
When I make request within a cassette named "projects/columns/delete"
7171
Then the response status should be 204
7272
And the response should be empty

lib/github_api/client/projects/columns.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def update(*args)
9292

9393
patch_request("/projects/columns/#{arguments.column_id}", params)
9494
end
95+
alias edit update
9596

9697
# Delete a project column
9798
#
@@ -110,6 +111,7 @@ def delete(*args)
110111

111112
delete_request("/projects/columns/#{arguments.column_id}", params)
112113
end
114+
alias remove delete
113115

114116
# Move a project column
115117
#
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": 367,
3+
"name": "To Do",
4+
"project_url": "https://api.github.com/projects/120",
5+
"created_at": "2016-09-05T14:18:44Z",
6+
"updated_at": "2016-09-05T14:22:28Z"
7+
}

0 commit comments

Comments
 (0)