Sha256: 8e734c6fa86500ba2ac4ddbcbeb5159dc9516979d5a90ccd0b6be3ad9c26f416
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' require 'mspec/expectations/expectations' require 'mspec/matchers' describe BeValidDNSName do it "matches when actual is 'localhost'" do BeValidDNSName.new.matches?("localhost").should be_truthy end it "matches when actual is 'localhost.localdomain'" do BeValidDNSName.new.matches?("localhost.localdomain").should be_truthy end it "matches when actual is hyphenated" do BeValidDNSName.new.matches?("local-host").should be_truthy end it "matches when actual is 'a.b.c'" do BeValidDNSName.new.matches?("a.b.c").should be_truthy end it "matches when actual has a trailing '.'" do BeValidDNSName.new.matches?("a.com.").should be_truthy end it "does not match when actual is not a valid dns name" do BeValidDNSName.new.matches?(".").should be_falsey end it "does not match when actual contains a hyphen at the beginning" do BeValidDNSName.new.matches?("-localhost").should be_falsey end it "does not match when actual contains a hyphen at the end" do BeValidDNSName.new.matches?("localhost-").should be_falsey end it "provides a failure message" do matcher = BeValidDNSName.new matcher.matches?(".") matcher.failure_message.should == ["Expected '.'", "to be a valid DNS name"] end it "provides a negative failure message" do matcher = BeValidDNSName.new matcher.matches?("localhost") matcher.negative_failure_message.should == ["Expected 'localhost'", "not to be a valid DNS name"] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mspec-1.9.1 | spec/matchers/be_valid_dns_name_spec.rb |
mspec-1.9.0 | spec/matchers/be_valid_dns_name_spec.rb |