Sha256: 4efe3b4469395a90fe5a2c27fd76fe46556939a1b2799cea95ea2baeb9bb21b5

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Staticpress::ViewHelpers do
  include Staticpress::Helpers

  basic_blog

  let(:post) { Staticpress::Content::Post.new :year => '2011', :month => '07', :day => '20', :title => 'hello' }
  let(:view_helpers) { Staticpress::ViewHelpers.new post }

  describe '#partial_with_one_post' do
    it '...' do
      expected = <<-HTML
<section>
  <article>#{post.render_partial.strip}</article>
</section>
      HTML
      expect(view_helpers.partial(:list_posts, :posts => [ post ])).to eq(expected)
    end
  end

  describe '#partial_with_no_posts' do
    it '...' do
      expected = <<-HTML
<section>
</section>
      HTML
      expect(view_helpers.partial(:list_posts, :posts => [ ])).to eq(expected)
    end
  end

  describe '#tag' do
    it '...' do
      expect(view_helpers.tag(:t)).to eq('<t></t>')
      expect(view_helpers.tag(:t, :one => 1)).to eq('<t one="1"></t>')
      expect(view_helpers.tag(:t) { 'content' }).to eq('<t>content</t>')
      expect(view_helpers.tag(:t) { view_helpers.tag(:n) }).to eq('<t><n></n></t>')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
staticpress-0.7.1 spec/unit/staticpress/view_helpers_spec.rb
staticpress-0.7.0 spec/unit/staticpress/view_helpers_spec.rb