Sha256: 78406d394eb5dc65d8d1c04ef3f8191fac45ab9e4035b0bacccef8fca9a9cb09
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
require 'spec_helper' describe DomainNameValidator do context "when domain_name is invalid" do before :each do @server = Server.new(:domain_name => "http://") end it "should set object as invalid" do @server.valid?.should be_false end it "should set an error" do @server.valid? @server.errors[:domain_name].should == ['is invalid'] end end context "when domain_name is valid" do before :each do @server = Server.new(:domain_name => "example.com") end it "should set object as valid" do @server.valid?.should be_true end it "should not set an error on attribute" do @server.valid? @server.errors[:domain_name].should be_blank end end it "should be valid with a nil value" do @server = Server.new(:domain_name => nil) @server.valid?.should be_true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_host-0.1.0 | spec/validates_host.rb/domain_name_validator_spec.rb |