Sha256: 5d9b9a76bbfc10f946912464b817613edb624b1275b2f516bbb300fe3762c19a

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true
require "spec_helper"

module SocialNetworking
  module Concerns
    # Collects data for feed/profiles page.
    describe ShowFeed do
      fixtures(:all)
      let(:terminated_participant) { participants(:participant1) }
      let(:participant1) { participants(:participant1) }
      let(:participant2) { participants(:participant2) }
      let(:participant3) { participants(:participant3) }
      let(:show_feed_extension) { Class.new { extend ShowFeed } }
      let(:active_record_results) do
        double("active_record_results", pluck: nil)
      end
      let(:array_results) { double("participant_array") }

      it "should exclude terminated participants from profile list" do
        expect(participant1)
          .to receive(:active_group) do
          double("active_record_results",
                 active_participants: active_record_results)
        end
        allow(active_record_results).to receive(:to_a) { array_results }
        allow(array_results).to receive(:delete_if) { [participant1] }
        allow(participant2)
          .to receive(:active_group)
          .exactly(8).times do
          double("result", active_participants: active_record_results)
        end
        allow(participant1)
          .to receive(:active_group)
          .exactly(8).times do
          double("result", active_participants: active_record_results)
        end

        show_feed_extension
          .feed_data_for(
            participant1,
            double("context",
                   social_networking_profile_path: "some_path")
          )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/controllers/social_networking/concerns/show_feed_spec.rb
social_networking-0.13.2 spec/controllers/social_networking/concerns/show_feed_spec.rb
social_networking-0.13.1 spec/controllers/social_networking/concerns/show_feed_spec.rb
social_networking-0.13.0 spec/controllers/social_networking/concerns/show_feed_spec.rb
social_networking-0.12.0 spec/controllers/social_networking/concerns/show_feed_spec.rb