Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
neoteric-archiver / spec / controllers / archiver_controller_spec.rb
Size: Mime:
class SomeArticleClass; end

require 'action_controller'
require 'neoteric-archiver/archiver_controller'

class SomeController < ActionController::Base
  include Neoteric::ArchiverController
  archiving SomeArticleClass
end

module Neoteric
  describe ArchiverController do
    let(:controller) { SomeController.new }

    describe "GET archive" do
      let(:published_posts) { stub }

      before :each do
        controller.stub(:params) do
          { :month => 8, :year => 2010 }
        end
      end

      it "grabs posts by month and year" do
        controller.stub(:render)

        SomeArticleClass.should_receive(:published)
                         .and_return(published_posts)

        published_posts.should_receive(:by_month)
                        .with(2010, 8)

        controller.send(:archive)
      end

      it "renders index" do
        SomeArticleClass.stub_chain(:published, :by_month)

        controller.should_receive(:render)
                  .with(:template => 'some_article_classes/index')

        controller.send(:archive)
      end
    end
  end
end