domain_validator 0.1.0 → 0.1.1

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.
@@ -8,7 +8,8 @@ module DomainValidator
8
8
 
9
9
  def validate_each(record, attr_name, value)
10
10
  validate_domain_format(record, attr_name, value)
11
- validate_domain_dns(record, attr_name, value) if options[:verify_dns]
11
+ # Only waste time with DNS check if record is invalid?
12
+ validate_domain_dns(record, attr_name, value) if record.errors.empty? && options[:verify_dns]
12
13
  end
13
14
 
14
15
  def validate_domain_format(record, attr_name, value)
@@ -1,3 +1,3 @@
1
1
  module DomainValidator
2
- VERSION = [0, 1, 0].join "."
2
+ VERSION = [0, 1, 1].join "."
3
3
  end
@@ -85,6 +85,13 @@ describe DomainValidator do
85
85
  end
86
86
 
87
87
  describe "DNS check" do
88
+ describe "an invalid domain" do
89
+ it "should not perform a DNS check" do
90
+ DomainValidator::DnsCheck.any_instance.should_not_receive(:has_record?)
91
+ UserVerifyDNS.new(:domain => "notadomain").should_not be_valid
92
+ end
93
+ end
94
+
88
95
  describe "a domain with a DNS record" do
89
96
  it "should be valid when :verify_dns is true" do
90
97
  UserVerifyDNS.new(:domain => "example.com").should be_valid
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domain_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-11 00:00:00.000000000 Z
12
+ date: 2013-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel