dnsimple-ruby 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. data/Gemfile +3 -1
  2. data/Gemfile.lock +4 -0
  3. data/VERSION +1 -1
  4. data/fixtures/vcr_cassettes/DNSimple_Contact/a_new_contact.yml +44 -0
  5. data/fixtures/vcr_cassettes/DNSimple_Contact/an_existing_contact.yml +44 -0
  6. data/fixtures/vcr_cassettes/DNSimple_Domain/_all.yml +181 -0
  7. data/fixtures/vcr_cassettes/DNSimple_Domain/applying_templates.yml +316 -0
  8. data/fixtures/vcr_cassettes/DNSimple_Domain/creating_a_new_domain.yml +46 -0
  9. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain.yml +46 -0
  10. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_id.yml +46 -0
  11. data/fixtures/vcr_cassettes/DNSimple_Domain/finding_an_existing_domain/by_name.yml +46 -0
  12. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_a_new_registrant_contact.yml +46 -0
  13. data/fixtures/vcr_cassettes/DNSimple_Domain/registration/with_an_existing_contact.yml +46 -0
  14. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_ca.yml +42 -0
  15. data/fixtures/vcr_cassettes/DNSimple_ExtendedAttribute/list_extended_attributes/for_com.yml +42 -0
  16. data/fixtures/vcr_cassettes/DNSimple_Record/_all.yml +361 -0
  17. data/fixtures/vcr_cassettes/DNSimple_Record/creating_a_new_record.yml +91 -0
  18. data/fixtures/vcr_cassettes/DNSimple_Record/find_a_record.yml +91 -0
  19. data/fixtures/vcr_cassettes/DNSimple_Template/a_template.yml +46 -0
  20. data/fixtures/vcr_cassettes/DNSimple_User/_me.yml +44 -0
  21. data/lib/dnsimple/extended_attribute.rb +0 -1
  22. data/spec/contact_spec.rb +12 -9
  23. data/spec/domain_spec.rb +46 -47
  24. data/spec/extended_attributes_spec.rb +2 -0
  25. data/spec/record_spec.rb +14 -20
  26. data/spec/spec_helper.rb +10 -0
  27. data/spec/template_spec.rb +1 -0
  28. data/spec/user_spec.rb +1 -0
  29. metadata +50 -5
@@ -0,0 +1,91 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
6
+ body:
7
+ headers:
8
+ accept:
9
+ - application/json
10
+ authorization:
11
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ x-ua-compatible:
18
+ - IE=Edge,chrome=1
19
+ access-control-allow-headers:
20
+ - Authorization
21
+ x-dnsimple-api-version:
22
+ - 1.0.0
23
+ etag:
24
+ - "\"a8559b2c4cd72b14d06e3074cb55827f\""
25
+ access-control-allow-methods:
26
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
27
+ access-control-allow-origin:
28
+ - "*"
29
+ content-type:
30
+ - application/json; charset=utf-8
31
+ x-runtime:
32
+ - "0.505668"
33
+ date:
34
+ - Sun, 22 May 2011 20:58:12 GMT
35
+ server:
36
+ - nginx/1.0.2
37
+ set-cookie:
38
+ - _dnsimple_session=BAh7CUkiD3Nlc3Npb25faWQGOgZFRiIlMGY1Zjk2M2M0Y2NlYjc2ZGE3MjI4OTk1NDk4Mzk5Y2VJIg5yZXR1cm5fdG8GOwBGIhwvZG9tYWlucy90ZXN0ZG9tYWluLmNvbUkiFXVzZXJfY3JlZGVudGlhbHMGOwBGSSIBgDhjN2RlMjhiNDYyZjRhYjUzMzEwMzVkNWIzZTNkNGRlNWMyNDQ1NTU1NjNiMGEzOTE1YWM4OTgyZDlmMGFkYzRiNGI4OTA1MzVkZDJjNjA0MjI0NTM1NGE5NTRiOGNkNzczYjE3N2Q3ODA0OGU0ZTk4OGQ1Y2MzNDYwZTBhOTNmBjsAVEkiGHVzZXJfY3JlZGVudGlhbHNfaWQGOwBGaQc%3D--1af6b213e14b2afa15f656d47a2f3c131a2c6710; path=/; HttpOnly
39
+ cache-control:
40
+ - max-age=0, private, must-revalidate
41
+ status:
42
+ - 200 OK
43
+ transfer-encoding:
44
+ - chunked
45
+ body: "{\"domain\":{\"created_at\":\"2011-05-22T18:40:47Z\",\"expires_at\":null,\"id\":141,\"lockable\":true,\"name\":\"testdomain.com\",\"name_server_status\":\"inactive\",\"real_time\":true,\"registrant_id\":null,\"registration_status\":\"hosted\",\"updated_at\":\"2011-05-22T20:10:29Z\",\"user_id\":2,\"uses_external_name_servers\":null,\"record_count\":13}}"
46
+ http_version: "1.1"
47
+ - !ruby/struct:VCR::HTTPInteraction
48
+ request: !ruby/struct:VCR::Request
49
+ method: :post
50
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records?record[content]=1.2.3.4&record[prio]=&record[ttl]=600&record[name]=&record[record_type]=A
51
+ body:
52
+ headers:
53
+ accept:
54
+ - application/json
55
+ authorization:
56
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
57
+ response: !ruby/struct:VCR::Response
58
+ status: !ruby/struct:VCR::ResponseStatus
59
+ code: 201
60
+ message: Created
61
+ headers:
62
+ x-ua-compatible:
63
+ - IE=Edge,chrome=1
64
+ access-control-allow-headers:
65
+ - Authorization
66
+ x-dnsimple-api-version:
67
+ - 1.0.0
68
+ location:
69
+ - /domains/141/records/193
70
+ access-control-allow-methods:
71
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
72
+ access-control-allow-origin:
73
+ - "*"
74
+ content-type:
75
+ - application/json; charset=utf-8
76
+ x-runtime:
77
+ - "0.530016"
78
+ date:
79
+ - Sun, 22 May 2011 20:58:13 GMT
80
+ server:
81
+ - nginx/1.0.2
82
+ set-cookie:
83
+ - _dnsimple_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRiIlM2VlNDRhMTVhM2ZlNGEwY2MwZDIyOGJiNzU3ZWQyMjBJIhV1c2VyX2NyZWRlbnRpYWxzBjsARkkiAYA4YzdkZTI4YjQ2MmY0YWI1MzMxMDM1ZDViM2UzZDRkZTVjMjQ0NTU1NTYzYjBhMzkxNWFjODk4MmQ5ZjBhZGM0YjRiODkwNTM1ZGQyYzYwNDIyNDUzNTRhOTU0YjhjZDc3M2IxNzdkNzgwNDhlNGU5ODhkNWNjMzQ2MGUwYTkzZgY7AFRJIhh1c2VyX2NyZWRlbnRpYWxzX2lkBjsARmkH--a9cbf902ea81f9a2df4b211d55b01b119cf67607; path=/; HttpOnly
84
+ cache-control:
85
+ - no-cache
86
+ status:
87
+ - 201 Created
88
+ transfer-encoding:
89
+ - chunked
90
+ body: "{\"record\":{\"content\":\"1.2.3.4\",\"created_at\":\"2011-05-22T20:58:13Z\",\"domain_id\":141,\"domain_service_id\":null,\"id\":193,\"name\":\"\",\"pdns_identifier\":null,\"prio\":null,\"record_type\":\"A\",\"special_type\":null,\"ttl\":600,\"updated_at\":\"2011-05-22T20:58:13Z\"}}"
91
+ http_version: "1.1"
@@ -0,0 +1,91 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/testdomain.com
6
+ body:
7
+ headers:
8
+ accept:
9
+ - application/json
10
+ authorization:
11
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ x-ua-compatible:
18
+ - IE=Edge,chrome=1
19
+ access-control-allow-headers:
20
+ - Authorization
21
+ x-dnsimple-api-version:
22
+ - 1.0.0
23
+ etag:
24
+ - "\"3b0419b984d57a56633b5454b1f8a1d5\""
25
+ access-control-allow-methods:
26
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
27
+ access-control-allow-origin:
28
+ - "*"
29
+ content-type:
30
+ - application/json; charset=utf-8
31
+ x-runtime:
32
+ - "0.478968"
33
+ date:
34
+ - Sun, 22 May 2011 20:59:51 GMT
35
+ server:
36
+ - nginx/1.0.2
37
+ set-cookie:
38
+ - _dnsimple_session=BAh7CUkiD3Nlc3Npb25faWQGOgZFRiIlN2FiMTZlNDY1NmRiMjg2NzU2Y2NiN2U3NzdhOWZmM2VJIg5yZXR1cm5fdG8GOwBGIhwvZG9tYWlucy90ZXN0ZG9tYWluLmNvbUkiFXVzZXJfY3JlZGVudGlhbHMGOwBGSSIBgDhjN2RlMjhiNDYyZjRhYjUzMzEwMzVkNWIzZTNkNGRlNWMyNDQ1NTU1NjNiMGEzOTE1YWM4OTgyZDlmMGFkYzRiNGI4OTA1MzVkZDJjNjA0MjI0NTM1NGE5NTRiOGNkNzczYjE3N2Q3ODA0OGU0ZTk4OGQ1Y2MzNDYwZTBhOTNmBjsAVEkiGHVzZXJfY3JlZGVudGlhbHNfaWQGOwBGaQc%3D--c55b618661e517b643e1a0822fc1f93ec03b177a; path=/; HttpOnly
39
+ cache-control:
40
+ - max-age=0, private, must-revalidate
41
+ status:
42
+ - 200 OK
43
+ transfer-encoding:
44
+ - chunked
45
+ body: "{\"domain\":{\"created_at\":\"2011-05-22T18:40:47Z\",\"expires_at\":null,\"id\":141,\"lockable\":true,\"name\":\"testdomain.com\",\"name_server_status\":\"inactive\",\"real_time\":true,\"registrant_id\":null,\"registration_status\":\"hosted\",\"updated_at\":\"2011-05-22T20:58:17Z\",\"user_id\":2,\"uses_external_name_servers\":null,\"record_count\":14}}"
46
+ http_version: "1.1"
47
+ - !ruby/struct:VCR::HTTPInteraction
48
+ request: !ruby/struct:VCR::Request
49
+ method: :get
50
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/domains/141/records/193
51
+ body:
52
+ headers:
53
+ accept:
54
+ - application/json
55
+ authorization:
56
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
57
+ response: !ruby/struct:VCR::Response
58
+ status: !ruby/struct:VCR::ResponseStatus
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ x-ua-compatible:
63
+ - IE=Edge,chrome=1
64
+ access-control-allow-headers:
65
+ - Authorization
66
+ x-dnsimple-api-version:
67
+ - 1.0.0
68
+ etag:
69
+ - "\"923b04d81bd4e86149b420852f2a6b14\""
70
+ access-control-allow-methods:
71
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
72
+ access-control-allow-origin:
73
+ - "*"
74
+ content-type:
75
+ - application/json; charset=utf-8
76
+ x-runtime:
77
+ - "0.237190"
78
+ date:
79
+ - Sun, 22 May 2011 20:59:52 GMT
80
+ server:
81
+ - nginx/1.0.2
82
+ set-cookie:
83
+ - _dnsimple_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRiIlMDUxYzg5MmNlNjE5Njc5MzQ4ZmE1MzZhNzk3OWM0NWJJIhV1c2VyX2NyZWRlbnRpYWxzBjsARkkiAYA4YzdkZTI4YjQ2MmY0YWI1MzMxMDM1ZDViM2UzZDRkZTVjMjQ0NTU1NTYzYjBhMzkxNWFjODk4MmQ5ZjBhZGM0YjRiODkwNTM1ZGQyYzYwNDIyNDUzNTRhOTU0YjhjZDc3M2IxNzdkNzgwNDhlNGU5ODhkNWNjMzQ2MGUwYTkzZgY7AFRJIhh1c2VyX2NyZWRlbnRpYWxzX2lkBjsARmkH--46258707ee461fd1b9c888077fc15e59bd586b87; path=/; HttpOnly
84
+ cache-control:
85
+ - max-age=0, private, must-revalidate
86
+ status:
87
+ - 200 OK
88
+ transfer-encoding:
89
+ - chunked
90
+ body: "{\"record\":{\"content\":\"1.2.3.4\",\"created_at\":\"2011-05-22T20:58:13Z\",\"domain_id\":141,\"domain_service_id\":null,\"id\":193,\"name\":\"\",\"pdns_identifier\":\"391\",\"prio\":null,\"record_type\":\"A\",\"special_type\":null,\"ttl\":600,\"updated_at\":\"2011-05-22T20:58:16Z\"}}"
91
+ http_version: "1.1"
@@ -0,0 +1,46 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/templates/googleapps
6
+ body:
7
+ headers:
8
+ accept:
9
+ - application/json
10
+ authorization:
11
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ x-ua-compatible:
18
+ - IE=Edge,chrome=1
19
+ access-control-allow-headers:
20
+ - Authorization
21
+ x-dnsimple-api-version:
22
+ - 1.0.0
23
+ etag:
24
+ - "\"1d07d0160ffe08a33b74f9e1d6672408\""
25
+ access-control-allow-methods:
26
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
27
+ access-control-allow-origin:
28
+ - "*"
29
+ content-type:
30
+ - application/json; charset=utf-8
31
+ x-runtime:
32
+ - "0.029187"
33
+ date:
34
+ - Sun, 22 May 2011 21:02:35 GMT
35
+ server:
36
+ - nginx/1.0.2
37
+ set-cookie:
38
+ - _dnsimple_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRiIlYzYzZmQyMzFhNGZkYTkyZDZkNDIxMDY2NzM3OTgxY2NJIhV1c2VyX2NyZWRlbnRpYWxzBjsARkkiAYA4YzdkZTI4YjQ2MmY0YWI1MzMxMDM1ZDViM2UzZDRkZTVjMjQ0NTU1NTYzYjBhMzkxNWFjODk4MmQ5ZjBhZGM0YjRiODkwNTM1ZGQyYzYwNDIyNDUzNTRhOTU0YjhjZDc3M2IxNzdkNzgwNDhlNGU5ODhkNWNjMzQ2MGUwYTkzZgY7AFRJIhh1c2VyX2NyZWRlbnRpYWxzX2lkBjsARmkH--6986703e166c15ee9ccc6e49d60ccb52c46310fe; path=/; HttpOnly
39
+ cache-control:
40
+ - max-age=0, private, must-revalidate
41
+ status:
42
+ - 200 OK
43
+ transfer-encoding:
44
+ - chunked
45
+ body: "{\"dns_template\":{\"created_at\":\"2011-05-22T15:24:28Z\",\"description\":\"The Google Mail Servers and Google Apps CNAME records in a single template.\",\"id\":3,\"name\":\"Google Apps\",\"short_name\":\"googleapps\",\"updated_at\":\"2011-05-22T15:24:28Z\",\"user_id\":null}}"
46
+ http_version: "1.1"
@@ -0,0 +1,44 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://anthonyeden%40gmail.com:letmein@test.dnsimple.com:443/users/me.json
6
+ body:
7
+ headers:
8
+ authorization:
9
+ - Basic YW50aG9ueWVkZW5AZ21haWwuY29tOmxldG1laW4=
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ x-ua-compatible:
16
+ - IE=Edge,chrome=1
17
+ access-control-allow-headers:
18
+ - Authorization
19
+ x-dnsimple-api-version:
20
+ - 1.0.0
21
+ etag:
22
+ - "\"e4d5d4d9cb9dc76feeade806f3bd7279\""
23
+ access-control-allow-methods:
24
+ - "[\"GET\", \"POST\", \"PUT\", \"DELETE\"]"
25
+ access-control-allow-origin:
26
+ - "*"
27
+ content-type:
28
+ - application/json; charset=utf-8
29
+ x-runtime:
30
+ - "0.265082"
31
+ date:
32
+ - Sun, 22 May 2011 17:22:11 GMT
33
+ server:
34
+ - nginx/1.0.2
35
+ set-cookie:
36
+ - _dnsimple_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRiIlMWU2YmZlM2RiMTYzYjVjMGU3MDkxNmJkNDQ2YzY1ODZJIhV1c2VyX2NyZWRlbnRpYWxzBjsARkkiAYA4YzdkZTI4YjQ2MmY0YWI1MzMxMDM1ZDViM2UzZDRkZTVjMjQ0NTU1NTYzYjBhMzkxNWFjODk4MmQ5ZjBhZGM0YjRiODkwNTM1ZGQyYzYwNDIyNDUzNTRhOTU0YjhjZDc3M2IxNzdkNzgwNDhlNGU5ODhkNWNjMzQ2MGUwYTkzZgY7AFRJIhh1c2VyX2NyZWRlbnRpYWxzX2lkBjsARmkH--bf86feb7fc8ebc12478b58fb30b6da5a6c95ed01; path=/; HttpOnly
37
+ cache-control:
38
+ - max-age=0, private, must-revalidate
39
+ status:
40
+ - 200 OK
41
+ transfer-encoding:
42
+ - chunked
43
+ body: "{\"user\":{\"access_code\":null,\"created_at\":\"2011-05-02T06:56:12Z\",\"default_contact_id\":2,\"email\":\"anthonyeden@gmail.com\",\"failed_login_count\":0,\"first_name\":null,\"id\":2,\"last_name\":null,\"login_count\":4,\"referral_token\":\"95cbf1f2231c8b\",\"style\":\"dark\",\"updated_at\":\"2011-05-22T17:22:11Z\",\"domain_count\":14,\"domain_limit\":500}}"
44
+ http_version: "1.1"
@@ -62,7 +62,6 @@ module DNSimple #:nodoc:
62
62
 
63
63
  case response.code
64
64
  when 200
65
- return [] unless response
66
65
  response.map { |r| ExtendedAttribute.new(r) }
67
66
  when 401
68
67
  raise RuntimeError, "Authentication failed"
data/spec/contact_spec.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe DNSimple::Contact do
4
+
4
5
  describe "a new contact" do
6
+ use_vcr_cassette
7
+
5
8
  let(:contact_attributes) {
6
9
  {
7
10
  :first_name => 'John',
@@ -15,18 +18,18 @@ describe DNSimple::Contact do
15
18
  :phone => '305 111 2222'
16
19
  }
17
20
  }
18
- before do
19
- @contact = DNSimple::Contact.create(contact_attributes)
20
- end
21
- after do
22
- @contact.delete
23
- end
24
21
  it "has specific attributes" do
25
- @contact.first_name.should eql(contact_attributes[:first_name])
26
- @contact.id.should_not be_nil
22
+ contact = DNSimple::Contact.create(contact_attributes)
23
+ contact.first_name.should eql(contact_attributes[:first_name])
24
+ contact.id.should_not be_nil
27
25
  end
26
+ end
27
+
28
+ describe "an existing contact" do
29
+ use_vcr_cassette
28
30
  it "can be found by id" do
29
- contact = DNSimple::Contact.find(@contact.id)
31
+ contact = DNSimple::Contact.find(32)
32
+ contact.should_not be_nil
30
33
  end
31
34
  end
32
35
  end
data/spec/domain_spec.rb CHANGED
@@ -1,70 +1,71 @@
1
1
  require File.join(File.dirname(__FILE__), 'spec_helper')
2
2
 
3
3
  describe DNSimple::Domain do
4
-
5
- describe "a new domain" do
6
- before do
7
- @domain = DNSimple::Domain.create("testdomain.com")
8
- end
9
- after do
10
- @domain.delete
11
- end
4
+ describe "creating a new domain" do
5
+ use_vcr_cassette
12
6
  it "has specific attributes" do
7
+ @domain = DNSimple::Domain.create("testdomain.com")
13
8
  @domain.name.should eql("testdomain.com")
14
9
  @domain.id.should_not be_nil
15
10
  end
16
- it "can be found by id" do
17
- domain = DNSimple::Domain.find(@domain.id)
18
- domain.name.should eql("testdomain.com")
19
- domain.id.should_not be_nil
11
+ end
12
+ describe "finding an existing domain" do
13
+ context "by id" do
14
+ use_vcr_cassette
15
+ it "can be found" do
16
+ domain = DNSimple::Domain.find(141)
17
+ domain.name.should eql("testdomain.com")
18
+ domain.id.should_not be_nil
19
+ end
20
20
  end
21
- it "can be found by name" do
22
- domain = DNSimple::Domain.find(@domain.name)
23
- domain.name.should eql("testdomain.com")
24
- domain.id.should_not be_nil
21
+ context "by name" do
22
+ use_vcr_cassette
23
+ it "can be found" do
24
+ domain = DNSimple::Domain.find("testdomain.com")
25
+ domain.name.should eql("testdomain.com")
26
+ domain.id.should_not be_nil
27
+ end
25
28
  end
26
29
  end
27
30
 
28
31
  context "registration" do
29
- describe "a new domain" do
30
- context "with an existing contact" do
31
- let(:name) { "testdomain-#{Time.now.to_i}.net" }
32
- let(:registrant) { Hash.new(:id => 4) }
33
- it "can be registered" do
34
- domain = DNSimple::Domain.register(name, registrant)
35
- domain.name.should eql(name)
36
- end
32
+ let(:name) { "testdomain.net" }
33
+
34
+ context "with an existing contact" do
35
+ use_vcr_cassette
36
+ it "can be registered" do
37
+ domain = DNSimple::Domain.register(name, {:id => 4})
38
+ domain.name.should eql(name)
37
39
  end
38
- context "with a new registrant contact" do
39
- let(:name) { "testdomain-#{Time.now.to_i}.net" }
40
- it "can be registered" do
41
- registrant = {
42
- :first_name => 'John',
43
- :last_name => 'Smith',
44
- :address1 => '123 SW 1st Street',
45
- :city => 'Miami',
46
- :state_or_province => 'FL',
47
- :country => 'US',
48
- :postal_code => '33143',
49
- :phone => '321 555 1212'
50
- }
51
- domain = DNSimple::Domain.register(name, registrant)
52
- domain.name.should eql(name)
53
- end
40
+ end
41
+
42
+ context "with a new registrant contact" do
43
+ use_vcr_cassette
44
+ it "can be registered" do
45
+ registrant = {
46
+ :first_name => 'John',
47
+ :last_name => 'Smith',
48
+ :address1 => '123 SW 1st Street',
49
+ :city => 'Miami',
50
+ :state_or_province => 'FL',
51
+ :country => 'US',
52
+ :postal_code => '33143',
53
+ :phone => '321 555 1212'
54
+ }
55
+ domain = DNSimple::Domain.register(name, registrant)
56
+ domain.name.should eql(name)
54
57
  end
55
58
  end
56
59
  end
57
60
 
58
61
  describe ".all" do
62
+ use_vcr_cassette
59
63
  before do
60
64
  @domains = []
61
65
  3.times do |n|
62
66
  @domains << DNSimple::Domain.create("testdomain#{n}.com")
63
67
  end
64
68
  end
65
- after do
66
- @domains.each { |d| d.destroy }
67
- end
68
69
  it "returns a list of domains" do
69
70
  domains = DNSimple::Domain.all
70
71
  domains.map { |d| d.name }.should include(*@domains.map { |d| d.name })
@@ -72,11 +73,9 @@ describe DNSimple::Domain do
72
73
  end
73
74
 
74
75
  describe "applying templates" do
76
+ use_vcr_cassette
75
77
  before do
76
- @domain = DNSimple::Domain.create("testdomain.com")
77
- end
78
- after do
79
- @domain.delete
78
+ @domain = DNSimple::Domain.find("testdomain.com")
80
79
  end
81
80
  it "applies a named template" do
82
81
  DNSimple::Record.all(@domain.name).should be_empty