<commit_before>require 'rails_helper'

RSpec.describe "articles/show.html.erb", type: :view do

  describe "on success" do
     it 'should not display a content field' do
      article = FactoryGirl.create(:article)
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(rendered).not_to match /only a stub/m
    end

    it 'displays litigation subheader if litigation text field is present' do
      article = FactoryGirl.create(:article, litigation: 'Legal Action')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Legal Action/m
    end

    it 'displays summary subheader if overview text field is present' do
      article = FactoryGirl.create(:article, overview: 'overview text')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Summary/m
    end

    it 'displays community action subheader if overview text field is present' do
      article = FactoryGirl.create(:article, community_action: 'community text')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Community and Family/m
    end
  end
end<commit_msg>Changed stub method to return Articles; #316<commit_after>require 'rails_helper'

RSpec.describe "articles/show.html.erb", type: :view do
  before do
    controller.singleton_class.class_eval do
      protected
        def marker_locations_for(articles)
          [Article.all]
        end
        helper_method :marker_locations_for
    end
  end
  describe "on success" do
     it 'should not display a content field' do
      article = FactoryGirl.create(:article)
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(rendered).not_to match /only a stub/m
    end

    it 'displays litigation subheader if litigation text field is present' do
      article = FactoryGirl.create(:article, litigation: 'Legal Action')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Legal Action/m
    end

    it 'displays summary subheader if overview text field is present' do
      article = FactoryGirl.create(:article, overview: 'overview text')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Summary/m
    end

    it 'displays community action subheader if overview text field is present' do
      article = FactoryGirl.create(:article, community_action: 'community text')
      article.state = FactoryGirl.create(:state)
      assign(:article, article)
      assign(:officers, article.officers.all)
      assign(:commentable, article)
      assign(:comments, article.comments)
      assign(:comment, Comment.new)
      assign(:subjects, article.subjects)
      render
      expect(response.body).to match /Community and Family/m
    end
  end
end
{'fraction_non_alphanumeric': 0.099644128113879, 'fraction_numerical': 0.0006672597864768683, 'mean_word_length': 3.2424528301886792, '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': '6803513', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1196, 'n_words': 324}