Sha256: eb9eaecb2e9de6c648bc3d491ef12f32b510239302353fa83c09f97b7513c697
Contents?: true
Size: 829 Bytes
Versions: 12
Compression:
Stored size: 829 Bytes
Contents
require 'spec_helper' describe SpudInquiryForm do it {should have_many(:spud_inquiries)} it {should have_many(:spud_inquiry_form_fields)} describe :validations do it "should be invalid if name is blank" do p = FactoryGirl.build(:spud_inquiry_form, :name => nil) p.should_not be_valid end it "should require a unique name" do p = FactoryGirl.create(:spud_inquiry_form, :name => "Test") p2 = FactoryGirl.build(:spud_inquiry_form, :name => "Test") p2.should_not be_valid end end describe :hooks do it "should generate a url_name before validating" do p = FactoryGirl.build(:spud_inquiry_form, :name => "Contact Us") p.should be_valid p.url_name.should == p.name.gsub(/[^a-zA-Z0-9\ ]/," ").gsub(/\ \ +/," ").gsub(/\ /,"-").downcase end end end
Version data entries
12 entries across 12 versions & 2 rubygems