Sha256: 7bc101b0d8fc8ab4b4e9a1c4645116ae9e6b0b3dc657b9fddb8fef7cb39db0c6

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

require 'spec_helper'

module Feeder
  describe ItemsController do
    routes { Feeder::Engine.routes }

    describe "GET 'index'" do
      let!(:items) do
        create_list :feeder_item, 50
      end

      it "returns http success" do
        get :index
        expect(response).to be_successful
      end

      context 'with a limit' do
        it 'loads the given amount of items' do
          get :index, limit: 5
          expect(assigns(:items).count).to eq 5
        end
      end

      context 'with stickies' do
        let!(:sticky) { create :feeder_item, :sticky, published_at: 2.day.ago }
        let!(:other)  { create :feeder_item, published_at: 1.day.ago }

        it 'places stickies first' do
          get :index
          expect(assigns(:items).first).to eq sticky
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feeder-0.5.1 spec/controllers/feeder/items_controller_spec.rb