Sha256: 394fd42083abacb533c604a56f582a610c38b6a712a05831ebd2204852af8a15

Contents?: true

Size: 1.02 KB

Versions: 29

Compression:

Stored size: 1.02 KB

Contents

require File.join(File.dirname(__FILE__), '/../../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
  
  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

29 entries across 29 versions & 9 rubygems

Version Path
SFEley-browsercms-3.0.2 test/unit/models/page_partial_test.rb
buzzware-browsercms-3.0.2 test/unit/models/page_partial_test.rb
coredumplings-browsercms-3.0.0 test/unit/models/page_partial_test.rb
we5-browsercms-3.0.1.1 test/unit/models/page_partial_test.rb
browsercms-3.1.5 test/unit/models/page_partial_test.rb
browsercms-3.1.4 test/unit/models/page_partial_test.rb
browsercms-3.1.3 test/unit/models/page_partial_test.rb
bf4-browsercms-3.1.0 test/unit/models/page_partial_test.rb
drujensen-browsercms-3.2.0 test/unit/models/page_partial_test.rb
browsercmsi-3.1.2 test/unit/models/page_partial_test.rb
browsercms-3.1.2 test/unit/models/page_partial_test.rb
browsercms-3.1.1 test/unit/models/page_partial_test.rb
browsercmsi-3.1.1 test/unit/models/page_partial_test.rb
browsercmsi-3.1.0 test/unit/models/page_partial_test.rb
browsercms-3.1.0 test/unit/models/page_partial_test.rb
we5-browsercms-3.1.0 test/unit/models/page_partial_test.rb
browsercms-3.0.6 test/unit/models/page_partial_test.rb
browsercms-3.0.5 test/unit/models/page_partial_test.rb
we5-browsercms-3.0.5.1 test/unit/models/page_partial_test.rb
we5-browsercms-3.0.5 test/unit/models/page_partial_test.rb