Sha256: 79bd04053513d983f21c59b4c7091b86489e1e213a8d5af1503ad9fe1066703f

Contents?: true

Size: 911 Bytes

Versions: 37

Compression:

Stored size: 911 Bytes

Contents

require File.expand_path('../../test_helper', File.dirname(__FILE__))

class CmsSnippetTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    Cms::Snippet.all.each do |snippet|
      assert snippet.valid?, snippet.errors.full_messages.to_s
    end
  end
  
  def test_validations
    snippet = Cms::Snippet.new
    snippet.save
    assert snippet.invalid?
    assert_has_errors_on snippet, [:label, :slug]
  end
  
  def test_label_assignment
    snippet = cms_sites(:default).snippets.new(
      :slug   => 'test'
    )
    assert snippet.valid?
    assert_equal 'Test', snippet.label
  end
  
  def test_update_forces_page_content_reload
    snippet = cms_snippets(:default)
    page = cms_pages(:default)
    assert_match snippet.content, page.content
    snippet.update_attribute(:content, 'new_snippet_content')
    page.reload
    assert_match /new_snippet_content/, page.content
  end
  
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.2 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.4.1 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.4.0 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.8 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.7 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.6 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.5 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.4 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.3 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.2 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.1 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.3.0 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.2.8 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.2.7 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.2.6 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.2.5 test/unit/models/snippet_test.rb
comfortable_mexican_sofa-1.2.4 test/unit/models/snippet_test.rb