Sha256: 29a8876f70bfa6d0692d92a6d0b9154457262579cbf0a31a737089acf8d93653

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

require 'rails_helper'

describe PostsController, type: :controller do

  before(:each) do
    activate_authlogic
  end

  describe 'index' do
    it 'should display a list of posts' do
      2.times { |_i| FactoryGirl.create(:spud_post) }
      get :index, blog_key: 'blog'
      expect(assigns(:posts).count).to be > 1
    end

    it 'should not display any posts' do
      Spud::Blog.config.query_for_user = ->(user) {
        if user.blank?
          '1=0'
        else
          {}
        end
      }
      get :index, blog_key: 'blog'
      expect(assigns(:posts).count).to be 0
      Spud::Blog.config.query_for_user = nil
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tb_blog-1.3.5 spec/controllers/posts_controller_spec.rb
tb_blog-1.3.4 spec/controllers/posts_controller_spec.rb