Sha256: 6bca3300c637f1f42ea40c95969ab8c2fbdf4d72c983fd98edcb4808dcd8419d

Contents?: true

Size: 935 Bytes

Versions: 5

Compression:

Stored size: 935 Bytes

Contents

require 'spec_helper'

describe SpudTemplate do
	it {should have_many(:spud_pages)}
	describe "validations" do
		it "should require a base layout" do
			t = Factory.build(:spud_template, :base_layout => nil)
			t.valid?.should == false
		end
		it "should require a page_part" do
			t = Factory.build(:spud_template, :page_parts => nil)
			t.valid?.should == false
		end
		it "should require a name" do
			t = Factory.build(:spud_template, :name => nil)
			t.valid?.should == false
		end
		it "should require a unique name" do
			t = Factory.build(:spud_template, :name => "test")
			t.save.should == true
			t = Factory.build(:spud_template, :name => "test")
			t.valid?.should == false
		end
		it "should not destroy pages on destroy" do
			t = Factory.build(:spud_template)
			t.save
			p = Factory.build(:spud_page,:id => 1,:spud_template => t)
			p.save
			t.destroy
			page = SpudPage.find(1)
			page.should == page
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spud_cms-0.8.17 spec/models/spud_template_spec.rb
spud_cms-0.8.15 spec/models/spud_template_spec.rb
spud_cms-0.8.14 spec/models/spud_template_spec.rb
spud_cms-0.8.13 spec/models/spud_template_spec.rb
spud_cms-0.8.12 spec/models/spud_template_spec.rb