<commit_before>require 'spec_helper'
include ActionView::Context
include ActionView::Helpers
include AnnouncementsHelper

describe AnnouncementsHelper do

  before do
    @announcement = Announcement.new
    @announcement.id = 1
    @announcement.body = "announcement text"
    
    @mocked_cookies = Hash.new
    stub!(:cookies).and_return(@mocked_cookies)
  end

  it "should output announcement text with no params" do
    @mocked_cookies["announcement_1"] = "not hidden"
    output = announce(@announcement)
    output.should include("hide message")
    output.should include("announcement text")
  end

  it "should not output announcement if was already hidden by user" do
    @mocked_cookies["announcement_1"] = "hidden"
    output = announce(@announcement)
    output.should be_nil
  end

  it "should outpu custom hide message and div class" do
    @mocked_cookies["announcement_1"] = "not hidden"
    output = announce(@announcement, hide_message: "X", div_class: "customdiv")
    output.should include("<div class=\"customdiv\"")
    output.should include(">X</span>")
  end

end<commit_msg>chaning the spec to match the new expected output from the changed helper<commit_after>require 'spec_helper'
include ActionView::Context
include ActionView::Helpers
include AnnouncementsHelper

describe AnnouncementsHelper do

  before do
    @announcement = Announcement.new
    @announcement.id = 1
    @announcement.body = "announcement text"
    
    @mocked_cookies = Hash.new
    stub!(:cookies).and_return(@mocked_cookies)
  end

  it "should output announcement text with no params" do
    @mocked_cookies["announcement_1"] = "not hidden"
    output = announce(@announcement)
    output.should include("x")
    output.should include("announcement text")
  end

  it "should not output announcement if was already hidden by user" do
    @mocked_cookies["announcement_1"] = "hidden"
    output = announce(@announcement)
    output.should be_nil
  end

  it "should outpu custom hide message and div class" do
    @mocked_cookies["announcement_1"] = "not hidden"
    output = announce(@announcement, hide_message: "X", div_class: "customdiv")
    output.should include("<div class=\"customdiv\"")
    output.should include(">X</a>")
  end

end
{'fraction_non_alphanumeric': 0.09955555555555555, 'fraction_numerical': 0.0035555555555555557, 'mean_word_length': 4.385167464114833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4145422', 'n_tokens_mistral': 689, 'n_tokens_neox': 682, 'n_words': 190}