<commit_before>require 'rails_helper'

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

  it 'displays content field if content field is not blank' 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)
  	render
  	expect(rendered).to match /new article/
  end

  # 	describe "check for default images" do
# 	  it "should have the images" do
# 	  	article = FactoryGirl.create(:article)

# 	  	render article
# 	    page.should have_css('img', text: "default-user-icon.png")
# 	  end
# 	end
end<commit_msg>adding a few more tests for articles/show subheaders<commit_after>require 'rails_helper'

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

  it 'displays stub article if content field is present' 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)
    render
    expect(rendered).to match /only a stub/m
  end

  it 'displays litigation subheader if litigation text field is present' do
    article = FactoryGirl.create(:article, content: nil, 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)
    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, content: nil, 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)
    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, content: nil, 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)
    render
    expect(response.body).to match /Community and Family/m
  end

  #   describe "check for default images" do
#     it "should have the images" do
#       article = FactoryGirl.create(:article)

#       render article
#       page.should have_css('img', text: "default-user-icon.png")
#     end
#   end
end
{'fraction_non_alphanumeric': 0.1090783569209527, 'fraction_numerical': 0.0, 'mean_word_length': 3.89527027027027, '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': '2877420', 'n_tokens_mistral': 894, 'n_tokens_neox': 837, 'n_words': 237}