<commit_before>require 'acceptance_helper'

feature "visiting the stream" do
  include Acceptance::NavigationHelper
  include Acceptance::ChannelHelper
  include Acceptance::FactHelper
  include Acceptance::ScrollHelper
  include PavlovSupport

  background do
    @user = FactoryGirl.create :active_user
  end

  scenario "adding first fact" do
    channel = backend_create_channel
    factlink = backend_create_fact
    backend_add_fact_to_channel factlink, channel

    sign_in_user @user
    go_to_stream

    page.should have_content('just added their first Factlink')
    page.should have_content(factlink.to_s)
  end

  scenario "revisiting stream after visiting a factlink page" do
    channel = backend_create_channel

    other_user = FactoryGirl.create :active_user
    other_channel = backend_create_channel_of_user other_user

    as(@user) do |p|
      p.interactor :'channels/add_subchannel', channel.id, other_channel.id
    end

    10.times.each do
      factlink = backend_create_fact_of_user other_user
      backend_add_fact_to_channel factlink, other_channel
    end

    sign_in_user @user

    go_to_stream
    go_to_first_fact
    go_to_stream
    assert_on_stream
<commit_msg>made annoying test pending<commit_after>require 'acceptance_helper'

feature "visiting the stream" do
  include Acceptance::NavigationHelper
  include Acceptance::ChannelHelper
  include Acceptance::FactHelper
  include Acceptance::ScrollHelper
  include PavlovSupport

  background do
    @user = FactoryGirl.create :active_user
  end

  scenario "adding first fact" do
    channel = backend_create_channel
    factlink = backend_create_fact
    backend_add_fact_to_channel factlink, channel

    sign_in_user @user
    go_to_stream

    page.should have_content('just added their first Factlink')
    page.should have_content(factlink.to_s)
  end

  scenario "revisiting stream after visiting a factlink page" do
    pending "this tests fails too much randomly to give any useful feedback"
    channel = backend_create_channel

    other_user = FactoryGirl.create :active_user
    other_channel = backend_create_channel_of_user other_user

    as(@user) do |p|
      p.interactor :'channels/add_subchannel', channel.id, other_channel.id
    end

    10.times.each do
      factlink = backend_create_fact_of_user other_user
      backend_add_fact_to_channel factlink, other_channel
    end

    sign_in_user @user

    go_to_stream
    go_to_first_fact
    go_to_stream
    assert_on_stream

{'fraction_non_alphanumeric': 0.04891740176423416, 'fraction_numerical': 0.0016038492381716118, 'mean_word_length': 4.112704918032787, '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': '3093753', 'n_tokens_mistral': 760, 'n_tokens_neox': 735, 'n_words': 189}