<commit_before>require 'pavlov_helper'
require_relative '../../../../app/interactors/queries/activities/for_followers_stream'

describe Queries::Activities::ForFollowersStream do
  include PavlovSupport
  before do
    stub_classes 'GraphUser'
  end

  describe '#call' do
    it 'filters the recent_activities using the Stream listener' do
      graph_user_id = 3
      activities = [double, nil, double, nil, double]
      graph_user = double :graph_user
      sorted_set = double :sorted_set
      query = described_class.new(graph_user_id: graph_user_id)

      allow(GraphUser)
        .to receive(:[])
        .with(graph_user_id)
        .and_return(graph_user)
      allow(graph_user)
        .to receive(:own_activities)
        .and_return(sorted_set)
      allow(sorted_set)
        .to receive(:below)
        .with('inf', count: 7, reversed: true, withscores: false)
        .and_return(activities)

      expect(query.call).to eq [activities[0], activities[2], activities[4]]
    end
  end
end
<commit_msg>Fixed title<commit_after>require 'pavlov_helper'
require_relative '../../../../app/interactors/queries/activities/for_followers_stream'

describe Queries::Activities::ForFollowersStream do
  include PavlovSupport
  before do
    stub_classes 'GraphUser'
  end

  describe '#call' do
    it 'filters the activities using the Stream listener' do
      graph_user_id = 3
      activities = [double, nil, double, nil, double]
      graph_user = double :graph_user
      sorted_set = double :sorted_set
      query = described_class.new(graph_user_id: graph_user_id)

      allow(GraphUser)
        .to receive(:[])
        .with(graph_user_id)
        .and_return(graph_user)
      allow(graph_user)
        .to receive(:own_activities)
        .and_return(sorted_set)
      allow(sorted_set)
        .to receive(:below)
        .with('inf', count: 7, reversed: true, withscores: false)
        .and_return(activities)

      expect(query.call).to eq [activities[0], activities[2], activities[4]]
    end
  end
end

{'fraction_non_alphanumeric': 0.10635155096011817, 'fraction_numerical': 0.004923682914820286, 'mean_word_length': 3.096774193548387, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7591986', 'n_tokens_mistral': 649, 'n_tokens_neox': 636, 'n_words': 143}