Sha256: 28e0979dcc0105cc3b355ecbe1865fa36ca2bca2a55c52a2eec0c6b7e0b1c937

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

require 'spec_helper'

describe ContentController do
  let(:context){ double() }
  let(:params){ {key: ''} }
  let(:controller){ ContentController.new(context: context, params: params) }
  let(:search_results){ double(paginate: []) }

  before :each do
    controller.stub(:redirect_back)
  end

  describe 'index action' do
    it 'should render index template' do
      context.should_receive(:haml).with('content/index'.to_sym, anything)
      controller.index
    end
  end

  describe 'search action' do
    it 'should render search template' do
      Backend.stub(:search){ search_results }
      context.should_receive(:haml).with('content/search'.to_sym, anything)
      controller.search
    end
  end

  describe 'delete action' do
    it 'should call del on Backend' do
      Backend.should_receive(:del)
      controller.delete
    end
  end

  describe 'change_database' do
    it 'should call set_database' do
      controller.should_receive(:set_database)
      controller.change_database
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_monitor-0.1 spec/controllers/content_controller_spec.rb