<commit_before>require 'spec_helper'

# Test for #83
describe "user links" do
  let(:topic) { Factory(:topic) }
  let(:post) { Factory(:post, :topic => topic) }

  context "with user_profile_links on" do
    before { Forem.user_profile_links = true }

    it "is able to click a user link" do
      visit forum_topic_path(post.forum, post.topic)
      # There should be at least one link on the page with the user's name
      click_link post.user.to_s
      page.should have_content("A user's page!")
    end
  end

  context "with user_profile_links off" do
    before { Forem.user_profile_links = false }

    it "user name is not a link" do
      visit forum_topic_path(post.forum, post.topic)
      # There should be no links on the page with the user's name
      Nokogiri::HTML(page.body).css("a").none? { |a| a.text.include?(post.user.to_s) }
    end
  end
end<commit_msg>Set approved topic + post in user link spec<commit_after>require 'spec_helper'

# Test for #83
describe "user links" do
  let(:topic) { Factory(:approved_topic) }
  let(:post) { Factory(:approved_post, :topic => topic) }

  context "with user_profile_links on" do
    before { Forem.user_profile_links = true }

    it "is able to click a user link" do
      visit forum_topic_path(post.forum, post.topic)
      # There should be at least one link on the page with the user's name
      click_link post.user.to_s
      page.should have_content("A user's page!")
    end
  end

  context "with user_profile_links off" do
    before { Forem.user_profile_links = false }

    it "user name is not a link" do
      visit forum_topic_path(post.forum, post.topic)
      # There should be no links on the page with the user's name
      Nokogiri::HTML(page.body).css("a").none? { |a| a.text.include?(post.user.to_s) }
    end
  end
end
{'fraction_non_alphanumeric': 0.10121681415929204, 'fraction_numerical': 0.0022123893805309734, 'mean_word_length': 3.256470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1984436', 'n_tokens_mistral': 607, 'n_tokens_neox': 584, 'n_words': 194}