Sha256: 80e2b055ff2e6c2f645f1662f2b4b80a2840a98fca58d7a4769f124df529c62c

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

require 'spec_helper'

module Enki
  describe ArchivesController do
    describe 'handling GET to index' do
      before(:each) do
        month = Struct.new(:date, :posts)
        @months = [ month.new( 1.month.ago.utc.beginning_of_month, [create(:post)] ) ]
        Post.stub!(:find_all_grouped_by_month).and_return(@months)
      end

      it "should be successful" do
        get :index

        response.should be_success
      end

      it "should render index template" do
        get :index

        response.should render_template('index')
      end

      it "should assign the found months for the view" do
        get :index

        assigns[:months].should == @months
      end

      it 'should find posts grouped by month' do
        Post.should_receive(:find_all_grouped_by_month).and_return(@months)
        
        get :index
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enki-engine-0.0.5 spec/controllers/archives_controller_spec.rb
enki-engine-0.0.4 spec/controllers/archives_controller_spec.rb
enki-engine-0.0.3 spec/controllers/archives_controller_spec.rb
enki-engine-0.0.2 spec/controllers/archives_controller_spec.rb