dnsimple-ruby 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.2.5
@@ -1,15 +1,19 @@
1
+ require 'dnsimple/command'
2
+
1
3
  module DNSimple
2
4
  module Commands
3
- class ListRecords
5
+ class ListRecords < Command
4
6
  def execute(args, options={})
5
7
  domain_name = args.shift
6
- records = Record.all(domain_name)
7
- puts "Found #{records.length} records for #{domain_name}"
8
+
9
+ records = Record.all(DNSimple::Domain.new(:name => domain_name))
10
+
11
+ say "Found #{records.length} records for #{domain_name}"
8
12
  records.each do |record|
9
13
  extra = ["ttl:#{record.ttl}", "id:#{record.id}"]
10
14
  extra << "prio:#{record.prio}" if record.record_type == "MX"
11
15
  extra = "(#{extra.join(', ')})"
12
- puts "\t#{record.name}.#{record.domain.name} (#{record.record_type})-> #{record.content} #{extra}"
16
+ say "\t#{record.name}.#{record.domain.name} (#{record.record_type})-> #{record.content} #{extra}"
13
17
  end
14
18
  end
15
19
  end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ require 'dnsimple/commands/list_records'
3
+
4
+ describe DNSimple::Commands::ListRecords do
5
+ before do
6
+ DNSimple::Record.expects(:all).with(instance_of(DNSimple::Domain)).returns(records)
7
+ end
8
+
9
+ let(:records) { [ record ] }
10
+ let(:record) { stub(:ttl => ttl, :id => id, :record_type => record_type, :name => name, :domain => domain, :content => content) }
11
+
12
+ let(:ttl) { 'ttl' }
13
+ let(:id) { 'id' }
14
+ let(:record_type) { 'A' }
15
+ let(:name) { 'name' }
16
+ let(:content) { 'content' }
17
+
18
+ let(:args) { [ domain_name ] }
19
+ let(:domain_name) { 'example.com' }
20
+ let(:domain) { DNSimple::Domain.new(:name => domain_name) }
21
+ let(:out) { StringIO.new }
22
+
23
+ it 'should retrieve all records and print them' do
24
+ described_class.new(out).execute(args)
25
+
26
+ out.string.should include(ttl)
27
+ out.string.should include(id)
28
+ out.string.should include(record_type)
29
+ out.string.should include(name)
30
+ out.string.should include(domain_name)
31
+ out.string.should include(content)
32
+ end
33
+ end
34
+
@@ -6,7 +6,7 @@ describe DNSimple::Commands::PurchaseCertificate do
6
6
  let(:out) { StringIO.new }
7
7
  let(:domain_name) { 'example.com' }
8
8
  context "with one argument" do
9
- it "purchases the certificate" do
9
+ xit "purchases the certificate" do
10
10
  DNSimple::Certificate.expects(:purchase).with(domain_name, '').returns(stub("certificate", :fqdn => domain_name))
11
11
  DNSimple::Commands::PurchaseCertificate.new(out).execute([domain_name])
12
12
  end
data/spec/domain_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
1
  describe DNSimple::Domain do
4
2
  let(:domain_name) { "example.com" }
5
3
  let(:contact_id) { 1 }
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
1
  describe DNSimple::ExtendedAttribute do
4
2
 
5
3
  describe "list extended attributes" do
data/spec/record_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
1
  describe DNSimple::Record do
4
2
 
5
3
  let(:domain_name) { 'example.com' }
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
1
  describe DNSimple::Template do
4
2
  describe "a template" do
5
3
  use_vcr_cassette
data/spec/user_spec.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
1
  describe DNSimple::User do
4
2
  describe ".me" do
5
3
  use_vcr_cassette
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 4
10
- version: 1.2.4
9
+ - 5
10
+ version: 1.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Eden
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-23 00:00:00 Z
18
+ date: 2012-02-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -305,6 +305,7 @@ files:
305
305
  - spec/command_spec.rb
306
306
  - spec/commands/add_service_spec.rb
307
307
  - spec/commands/create_record_spec.rb
308
+ - spec/commands/list_records_spec.rb
308
309
  - spec/commands/purchase_certificate_spec.rb
309
310
  - spec/commands/submit_certificate_spec.rb
310
311
  - spec/contact_spec.rb
@@ -352,6 +353,7 @@ test_files:
352
353
  - spec/command_spec.rb
353
354
  - spec/commands/add_service_spec.rb
354
355
  - spec/commands/create_record_spec.rb
356
+ - spec/commands/list_records_spec.rb
355
357
  - spec/commands/purchase_certificate_spec.rb
356
358
  - spec/commands/submit_certificate_spec.rb
357
359
  - spec/contact_spec.rb