Class: BeValidDNSName
- Defined in:
- lib/extensions/mspec/mspec/matchers/be_valid_dns_name.rb
Constant Summary collapse
- VALID_DNS =
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\.?$/
Instance Method Summary collapse
Instance Method Details
#failure_message ⇒ Object
11 12 13 |
# File 'lib/extensions/mspec/mspec/matchers/be_valid_dns_name.rb', line 11 def ["Expected '#{@actual}'", "to be a valid DNS name"] end |
#matches?(actual) ⇒ Boolean
6 7 8 9 |
# File 'lib/extensions/mspec/mspec/matchers/be_valid_dns_name.rb', line 6 def matches?(actual) @actual = actual (VALID_DNS =~ @actual) == 0 end |
#negative_failure_message ⇒ Object
15 16 17 |
# File 'lib/extensions/mspec/mspec/matchers/be_valid_dns_name.rb', line 15 def ["Expected '#{@actual}'", "not to be a valid DNS name"] end |