Sha256: 4ec279a35a92ebe50ecc78f2a48c97be1c42bb899e5ce7d7c4b6417254b06cb5
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe DomainNameValidator do context "when domain_name is invalid" do before :each do @server = Server.new(:domain_name => "http://") I18n.stub(:t).with(:"activerecord.errors.models.server.attributes.domain_name.invalid", :default => :"activerecord.errors.messages.invalid").and_return("is invalid") 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
4 entries across 4 versions & 1 rubygems