Sha256: 80d3dbcfe2fc34375b4e4b62cbd982e048b05f9fb7b793761e3661767a83a4c7

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

module SocialNetworking
  module Concerns
    # Spec for profile page feed functionality.
    module ProfilePage
      describe Feed do
        let(:participant) do
          instance_double(::Participant, id: 1)
        end

        def items(page)
          Feed.new(
            participant_id: participant.id,
            page: page).page_items
        end

        describe "when feed items exist" do
          before do
            allow(Serializers::NudgeSerializer)
              .to receive(:from_collection)
              .and_return([
                { createdAtRaw: "" },
                { createdAtRaw: "" }
              ])
            allow(Serializers::OnTheMindStatementSerializer)
              .to receive(:from_collection)
              .and_return([
                { createdAtRaw: "" },
                { createdAtRaw: "" }
              ])
            allow(Serializers::SharedItemSerializer)
              .to receive(:from_collection)
              .and_return([
                { createdAtRaw: "" },
                { createdAtRaw: "" }
              ])
          end

          it "returns only 5 items on first request" do
            expect(items(0).count).to eq 5
          end

          it "returns the next item(s) on second request" do
            expect(items(1).count).to eq 1
          end
        end

        describe "when no feed items exist" do
          it "returns empty array" do
            expect(items(0)).to eq []
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.7 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.6 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.5 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.4 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.3 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.2 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.1 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.11.0 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.10.0 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb
social_networking-0.9.3 spec/controllers/social_networking/concerns/profile_page/feed_spec.rb