Sha256: 981f74f79995b9a574a2416862b1ad669be4f71d794c66b31138f0efa3d8eee0
Contents?: true
Size: 1.21 KB
Versions: 6
Compression:
Stored size: 1.21 KB
Contents
require 'test_helper' class PagePartialTest < ActiveSupport::TestCase def setup @page_partial = Factory.build(:page_partial, :name => "_test") File.delete(@page_partial.file_path) if File.exists?(@page_partial.file_path) end def teardown File.delete(@page_partial.file_path) if File.exists?(@page_partial.file_path) end test "Name used to build the form" do assert_equal "page_partial", Cms::PagePartial.resource_collection_name end test "resource_name works for namespaced templates" do assert_equal "page_partials", Cms::PagePartial.resource_name end def test_create assert !File.exists?(@page_partial.file_path), "partial file already exists" assert_valid @page_partial assert @page_partial.save assert File.exists?(@page_partial.file_path), "partial file was not written to disk" end def test_for_valid_name assert_not_valid Factory.build(:page_partial, :name => "Fancy") assert_not_valid Factory.build(:page_partial, :name => "foo bar") partial = Factory.build(:page_partial, :name => "subpage_1_column") assert_valid partial assert_equal "_subpage_1_column", partial.name assert_valid Factory.build(:page_partial, :name => "_sidebar") end end
Version data entries
6 entries across 6 versions & 1 rubygems