Sha256: 7d21752ed559d6a3ea39191c66114882475f3d89c36d27b8ca6174b6cb1344a4

Contents?: true

Size: 974 Bytes

Versions: 5

Compression:

Stored size: 974 Bytes

Contents

require './test/test_includes'

class OwlTestPage < Test::Unit::TestCase

  include OwlTestIncludes

  def test_page_basics
    setup_page

    assert        @page.publish?

    assert_equal  @page.front_matter['title'],
                  @page.setting('title')

    assert_equal  @page.front_matter['date'],
                  @page.setting('date')
  end

  def test_no_front_matter
    path  = '/no-front-matter' # this page has no front matter
    page  = Owl::Lib::Page.new(path, current_scope)

    assert_equal  Hash.new, page.front_matter
  end

  def test_all_posts
    get "/home"
    assert last_response.ok?

    posts = current_scope.posts
    assert posts.length > 0
  end 

  def test_content
    setup_page
    assert @page.content.length <= @page.html.length
  end

  def test_unpublished_posts
    posts     = current_scope.posts
    all_posts = current_scope.posts(true)   # include unpublished posts

    assert posts.length <= all_posts.length
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
owl-cms-0.1.5 test/test_page.rb
owl-cms-0.1.3 test/test_page.rb
owl-cms-0.1.2 test/test_page.rb
owl-cms-0.1.1 test/test_page.rb
owl-cms-0.1.0 test/test_page.rb