Skip to content

Commit

Permalink
Use a dedicated folder for HTTP fixtures
Browse files Browse the repository at this point in the history
The folder should be unique across all clients, and it should not
conflict with `fixtures`, `cassettes`, etc.
  • Loading branch information
weppos committed Jan 12, 2016
1 parent 1644217 commit 0280f0a
Show file tree
Hide file tree
Showing 25 changed files with 149 additions and 149 deletions.
6 changes: 3 additions & 3 deletions spec/dnsimple/client/client_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def list(account_id, options = {})

before do
stub_request(:get, %r[/v2/#{account_id}/list\?page=1&per_page=100])
.to_return(read_fixture("pages-1of3.http"))
.to_return(read_http_fixture("pages-1of3.http"))
stub_request(:get, %r[/v2/#{account_id}/list\?page=2&per_page=100])
.to_return(read_fixture("pages-2of3.http"))
.to_return(read_http_fixture("pages-2of3.http"))
stub_request(:get, %r[/v2/#{account_id}/list\?page=3&per_page=100])
.to_return(read_fixture("pages-3of3.http"))
.to_return(read_http_fixture("pages-3of3.http"))
end

it "loops all the pages" do
Expand Down
12 changes: 6 additions & 6 deletions spec/dnsimple/client/domains_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

before do
stub_request(:get, %r[/v2/#{account_id}/domains])
.to_return(read_fixture("domains/domains/success.http"))
.to_return(read_http_fixture("domains/domains/success.http"))
end

it "builds the correct request" do
Expand Down Expand Up @@ -70,7 +70,7 @@

before do
stub_request(:post, %r[/v2/#{account_id}/domains$])
.to_return(read_fixture("domains/create_domain/created.http"))
.to_return(read_http_fixture("domains/create_domain/created.http"))
end

let(:attributes) { { name: "example.com" } }
Expand Down Expand Up @@ -98,7 +98,7 @@

before do
stub_request(:get, %r[/v2/#{account_id}/domains/.+$])
.to_return(read_fixture("domains/domain/success.http"))
.to_return(read_http_fixture("domains/domain/success.http"))
end

it "builds the correct request" do
Expand Down Expand Up @@ -129,7 +129,7 @@
context "when the domain does not exist" do
it "raises NotFoundError" do
stub_request(:get, %r[/v2])
.to_return(read_fixture("notfound-domain.http"))
.to_return(read_http_fixture("notfound-domain.http"))

expect {
subject.domain(account_id, "example.com")
Expand All @@ -143,7 +143,7 @@

before do
stub_request(:delete, %r[/v2/#{account_id}/domains/.+$])
.to_return(read_fixture("domains/delete_domain/success.http"))
.to_return(read_http_fixture("domains/delete_domain/success.http"))
end

it "builds the correct request" do
Expand All @@ -164,7 +164,7 @@
context "when the domain does not exist" do
it "raises NotFoundError" do
stub_request(:delete, %r[/v2])
.to_return(read_fixture("notfound-domain.http"))
.to_return(read_http_fixture("notfound-domain.http"))

expect {
subject.delete_domain(account_id, "example.com")
Expand Down
6 changes: 3 additions & 3 deletions spec/dnsimple/client/misc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
describe "#whoami" do
before do
stub_request(:get, %r[/v2/whoami$])
.to_return(read_fixture("misc/whoami/success.http"))
.to_return(read_http_fixture("misc/whoami/success.http"))
end

it "builds the correct request" do
Expand All @@ -29,7 +29,7 @@
context "when authenticated as account" do
before do
stub_request(:get, %r[/v2/whoami$])
.to_return(read_fixture("misc/whoami/success_account.http"))
.to_return(read_http_fixture("misc/whoami/success_account.http"))
end

it "sets the account" do
Expand All @@ -42,7 +42,7 @@
context "when authenticated as user" do
before do
stub_request(:get, %r[/v2/whoami$])
.to_return(read_fixture("misc/whoami/success_user.http"))
.to_return(read_http_fixture("misc/whoami/success_user.http"))
end

it "sets the user" do
Expand Down
26 changes: 13 additions & 13 deletions spec/dnsimple/client/zones_records_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

before do
stub_request(:get, %r[/v2/#{account_id}/zones/#{zone_id}/records])
.to_return(read_fixture("zones/records/success.http"))
.to_return(read_http_fixture("zones/records/success.http"))
end

it "builds the correct request" do
Expand Down Expand Up @@ -59,7 +59,7 @@
# context "when the zone does not exist" do
# it "raises NotFoundError" do
# stub_request(:get, %r[/v2])
# .to_return(read_fixture("notfound-zone.http"))
# .to_return(read_http_fixture("notfound-zone.http"))
#
# expect {
# subject.records(account_id, zone_id)
Expand All @@ -84,7 +84,7 @@

before do
stub_request(:post, %r[/v2/#{account_id}/zones/#{zone_id}/records$])
.to_return(read_fixture("zones/create_record/created.http"))
.to_return(read_http_fixture("zones/create_record/created.http"))
end

let(:attributes) { { record_type: "A", name: "www", content: "127.0.0.1" } }
Expand All @@ -109,7 +109,7 @@
# context "when the zone does not exist" do
# it "raises NotFoundError" do
# stub_request(:post, %r[/v2])
# .to_return(read_fixture("notfound-zone.http"))
# .to_return(read_http_fixture("notfound-zone.http"))
#
# expect {
# subject.create_zone(account_id, zone_id, attributes)
Expand All @@ -124,7 +124,7 @@

before do
stub_request(:get, %r[/v2/#{account_id}/zones/#{zone_id}/records/.+$])
.to_return(read_fixture("zones/record/success.http"))
.to_return(read_http_fixture("zones/record/success.http"))
end

it "builds the correct request" do
Expand Down Expand Up @@ -156,7 +156,7 @@
# context "when the zone does not exist" do
# it "raises NotFoundError" do
# stub_request(:get, %r[/v2])
# .to_return(read_fixture("notfound-zone.http"))
# .to_return(read_http_fixture("notfound-zone.http"))
#
# expect {
# subject.record(account_id, zone_id, "0")
Expand All @@ -167,7 +167,7 @@
# context "when the record does not exist" do
# it "raises NotFoundError" do
# stub_request(:get, %r[/v2])
# .to_return(read_fixture("notfound-record.http"))
# .to_return(read_http_fixture("notfound-record.http"))
#
# expect {
# subject.record(account_id, zone_id, "0")
Expand All @@ -182,7 +182,7 @@

before do
stub_request(:patch, %r[/v2/#{account_id}/zones/#{zone_id}/records/.+$])
.to_return(read_fixture("zones/update_record/success.http"))
.to_return(read_http_fixture("zones/update_record/success.http"))
end

let(:attributes) { { content: "127.0.0.1", priority: "1" } }
Expand All @@ -207,7 +207,7 @@
# context "when the zone does not exist" do
# it "raises NotFoundError" do
# stub_request(:patch, %r[/v2])
# .to_return(read_fixture("notfound-zone.http"))
# .to_return(read_http_fixture("notfound-zone.http"))
#
# expect {
# subject.update_record(account_id, zone_id, "0", {})
Expand All @@ -218,7 +218,7 @@
# context "when the record does not exist" do
# it "raises NotFoundError" do
# stub_request(:patch, %r[/v2])
# .to_return(read_fixture("notfound-record.http"))
# .to_return(read_http_fixture("notfound-record.http"))
#
# expect {
# subject.update_record(account_id, zone_id, "0", {})
Expand All @@ -233,7 +233,7 @@

before do
stub_request(:delete, %r[/v2/#{account_id}/zones/#{zone_id}/records/.+$])
.to_return(read_fixture("zones/delete_record/success.http"))
.to_return(read_http_fixture("zones/delete_record/success.http"))
end

it "builds the correct request" do
Expand All @@ -254,7 +254,7 @@
# context "when the zone does not exist" do
# it "raises NotFoundError" do
# stub_request(:delete, %r[/v2])
# .to_return(read_fixture("notfound-zone.http"))
# .to_return(read_http_fixture("notfound-zone.http"))
#
# expect {
# subject.delete_record(account_id, zone_id, "0")
Expand All @@ -265,7 +265,7 @@
# context "when the record does not exist" do
# it "raises NotFoundError" do
# stub_request(:delete, %r[/v2])
# .to_return(read_fixture("notfound-record.http"))
# .to_return(read_http_fixture("notfound-record.http"))
#
# expect {
# subject.delete_record(account_id, zone_id, "0")
Expand Down
28 changes: 14 additions & 14 deletions spec/files/badgateway.http → spec/fixtures.http/badgateway.http
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Mon, 22 Dec 2014 14:16:12 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Mon, 22 Dec 2014 14:16:12 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
HTTP/1.1 201 Created
Server: nginx
Date: Fri, 18 Dec 2015 16:38:07 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3986
X-RateLimit-Reset: 1450456686
ETag: W/"87e018b900e5f210c3236f63d3b2f4df"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 0d6f1ea7-f702-4317-85f0-04874b69315d
X-Runtime: 0.257489
Strict-Transport-Security: max-age=31536000

HTTP/1.1 201 Created
Server: nginx
Date: Fri, 18 Dec 2015 16:38:07 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3986
X-RateLimit-Reset: 1450456686
ETag: W/"87e018b900e5f210c3236f63d3b2f4df"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 0d6f1ea7-f702-4317-85f0-04874b69315d
X-Runtime: 0.257489
Strict-Transport-Security: max-age=31536000

{"data":{"id":5823,"account_id":24,"registrant_id":null,"name":"example-1417881397.com","unicode_name":"example-1417881397.com","token":"domain-token","state":"hosted","auto_renew":false,"private_whois":false,"expires_on":null,"created_at":"2015-12-18T16:38:07.615Z","updated_at":"2015-12-18T16:38:07.615Z"}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
HTTP/1.1 204 No Content
Server: nginx
Date: Fri, 18 Dec 2015 16:13:54 GMT
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3990
X-RateLimit-Reset: 1450455233
Cache-Control: no-cache
X-Request-Id: a2924814-4aff-42cf-9785-9327ce097d0a
X-Runtime: 0.241247
Strict-Transport-Security: max-age=31536000

HTTP/1.1 204 No Content
Server: nginx
Date: Fri, 18 Dec 2015 16:13:54 GMT
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3990
X-RateLimit-Reset: 1450455233
Cache-Control: no-cache
X-Request-Id: a2924814-4aff-42cf-9785-9327ce097d0a
X-Runtime: 0.241247
Strict-Transport-Security: max-age=31536000

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Dec 2015 21:54:55 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3993
X-RateLimit-Reset: 1450302894
ETag: W/"e7282090a87379d1fa3507ba6bfd1721"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 3d8da18a-b8b2-4bfd-827c-860da837c80f
X-Runtime: 0.020346
Strict-Transport-Security: max-age=31536000

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Dec 2015 21:54:55 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3993
X-RateLimit-Reset: 1450302894
ETag: W/"e7282090a87379d1fa3507ba6bfd1721"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 3d8da18a-b8b2-4bfd-827c-860da837c80f
X-Runtime: 0.020346
Strict-Transport-Security: max-age=31536000

{"data":{"id":1745,"account_id":24,"registrant_id":409,"name":"example-1417881397.com","unicode_name":"example-1417881397.com","token":"domain-token","state":"expired","auto_renew":false,"private_whois":false,"expires_on":"2015-12-06","created_at":"2014-12-06T15:56:55.573Z","updated_at":"2015-12-09T00:20:56.056Z"}}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Dec 2015 13:36:11 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3997
X-RateLimit-Reset: 1450272970
ETag: W/"2679531e6cce6cd326f255255d7a0005"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: a87f1b44-150a-4ed0-b7da-9301fa1465b0
X-Runtime: 0.093714
Strict-Transport-Security: max-age=31536000

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 16 Dec 2015 13:36:11 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3997
X-RateLimit-Reset: 1450272970
ETag: W/"2679531e6cce6cd326f255255d7a0005"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: a87f1b44-150a-4ed0-b7da-9301fa1465b0
X-Runtime: 0.093714
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1745,"account_id":24,"registrant_id":409,"name":"example-1417881397.com","unicode_name":"example-1417881397.com","token":"domain-token","state":"expired","auto_renew":false,"private_whois":false,"expires_on":"2015-12-06","created_at":"2014-12-06T15:56:55.573Z","updated_at":"2015-12-09T00:20:56.056Z"},{"id":1744,"account_id":24,"registrant_id":409,"name":"example-1417880719.com","unicode_name":"example-1417880719.com","token":"domain-token","state":"expired","auto_renew":false,"private_whois":false,"expires_on":"2015-12-06","created_at":"2014-12-06T15:46:52.411Z","updated_at":"2015-12-09T00:20:53.572Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
X-Runtime: 0.141588
Strict-Transport-Security: max-age=31536000

{"data":{"user":null,"account":{"id":24,"email":"example-account@example.com"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
X-Runtime: 0.141588
Strict-Transport-Security: max-age=31536000

{"data":{"user":null,"account":{"id":24,"email":"example-account@example.com"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
X-Runtime: 0.141588
Strict-Transport-Security: max-age=31536000

{"data":{"user":{"id":24,"email":"example-user@example.com"},"account":null}}
{"data":{"user":{"id":1,"email":"example-user@example.com"},"account":null}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0280f0a

Please sign in to comment.