Sha256: f94b632b9dde6a67d872de47eca98e46d392c5d27260468080d391d04c305369
Contents?: true
Size: 930 Bytes
Versions: 8
Compression:
Stored size: 930 Bytes
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') describe "Url Validation" do before(:each) do TestRecord.reset_callbacks(:validate) TestRecord.validates :url, :url => true end subject { TestRecord.new } it "accepts valid urls" do subject.url = 'http://www.verrot.fr' subject.should be_valid subject.should have(0).errors end it "accepts valid SSL urls" do subject.url = 'https://www.verrot.fr' subject.should be_valid subject.should have(0).errors end describe "for invalid urls" do before :each do subject.url = 'http://^^^^.fr' end it "rejects invalid urls" do subject.should_not be_valid subject.should have(1).error end it "generates an error message of type invalid" do subject.should_not be_valid subject.errors[:url].should include subject.errors.generate_message(:url, :invalid) end end end
Version data entries
8 entries across 8 versions & 1 rubygems