<commit_before>require 'acceptance_helper'

feature "favouriting a topic", type: :request do
  include Acceptance::TopicHelper
  include Acceptance::ChannelHelper
  include Acceptance::ProfileHelper
  include Acceptance::AddToChannelModalHelper

  scenario "When I favourite a topic I should be able to navigate to it in my sidebar" do
    @user = create :active_user
    other_user = create :active_user

    other_users_channel =
      backend_create_viewable_channel_for other_user, title: 'Henk'
    topic = other_users_channel.topic

    sign_in_user @user

    go_to_topic_page_of topic

    within_topic_header do
      find('button', text: 'Favorite').click
    end

    go_to_profile_page_of @user
    click_topic_in_sidebar 'Henk'
    assert_on_topic_page topic
  end

  scenario "When I unfavourite a topic I should *not* be able to navigate to it in my sidebar" do
    @user = create :active_user
    other_user = create :active_user

    other_users_channel =
      backend_create_viewable_channel_for other_user, title: 'Henk'
    topic = other_users_channel.topic

    sign_in_user @user

    go_to_topic_page_of topic
    within_topic_header do
      find('button', text: 'Favorite').click
    end

    go_to_topic_page_of topic
    within_topic_header do
      find('button', text: 'Favorited').click
    end

    go_to_profile_page_of @user
    page.should_not have_content 'Henk'
  end
end<commit_msg>Fix acceptance tests<commit_after>require 'acceptance_helper'

feature "favouriting a topic", type: :request do
  include Acceptance::TopicHelper
  include Acceptance::ChannelHelper
  include Acceptance::ProfileHelper
  include Acceptance::AddToChannelModalHelper

  scenario "When I favourite a topic I should be able to navigate to it in my sidebar" do
    @user = create :active_user
    other_user = create :active_user

    other_users_channel =
      backend_create_viewable_channel_for other_user, title: 'Henk'
    topic = other_users_channel.topic

    sign_in_user @user

    go_to_topic_page_of topic

    within_topic_header do
      find('button', text: 'Follow topic').click
    end

    go_to_profile_page_of @user
    click_topic_in_sidebar 'Henk'
    assert_on_topic_page topic
  end

  scenario "When I unfavourite a topic I should *not* be able to navigate to it in my sidebar" do
    @user = create :active_user
    other_user = create :active_user

    other_users_channel =
      backend_create_viewable_channel_for other_user, title: 'Henk'
    topic = other_users_channel.topic

    sign_in_user @user

    go_to_topic_page_of topic
    within_topic_header do
      find('button', text: 'Follow topic').click
    end

    go_to_topic_page_of topic
    within_topic_header do
      find('button', text: 'Followed').click
    end

    go_to_profile_page_of @user
    page.should_not have_content 'Henk'
  end
end
{'fraction_non_alphanumeric': 0.05886475122634898, 'fraction_numerical': 0.0, 'mean_word_length': 3.8803418803418803, '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': '3423874', 'n_tokens_mistral': 906, 'n_tokens_neox': 877, 'n_words': 247}