Sha256: f00d62e636e52978ac0d5228b1ca07439676cb28d649f2f59fe96fb9c593a852

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

module Enki

  describe "/archives/index.html" do
    def tag(name)
      mock_model(Tag, :name => name)
    end

    before(:each) do
      view.stub!(:enki_config).and_return(Enki::Config.default)

      month = Struct.new(:date, :posts)
      assign :months, [
        month.new(1.month.ago.utc.beginning_of_month, [
          mock_model(Post, :title => 'Post A', :published_at => 3.weeks.ago.utc, :slug => 'post-a', :tags => [tag("Code")])
        ]),
        month.new(2.months.ago.utc.beginning_of_month, [
          mock_model(Post, :title => 'Post B', :published_at => 6.weeks.ago.utc, :slug => 'post-b', :tags => [tag("Code"), tag("Ruby")]),
          mock_model(Post, :title => 'Post C', :published_at => 7.weeks.ago.utc, :slug => 'post-c', :tags => [])
        ])
      ]
    end

    after(:each) do
      rendered.should be_valid_html5_fragment
    end

    it 'renders posts grouped by month' do
      render :template => "/enki/archives/index", :formats => [:html]
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enki-engine-0.0.5 spec/views/archives/index.html_spec.rb
enki-engine-0.0.4 spec/views/archives/index.html_spec.rb
enki-engine-0.0.3 spec/views/archives/index.html_spec.rb
enki-engine-0.0.2 spec/views/archives/index.html_spec.rb