<commit_before>require 'spec_helper'

describe Admin::AnnouncementsController, :type => :feature do
  before :each do
    create_and_login_user
  end

  it "index" do
    saved_current_announcement
    visit admin_announcements_path
    page.should have_selector('h1', text: 'Administer Announcements')
    page.should have_content('current')
  end
  
  describe 'create' do
    before(:each) do
      visit admin_announcements_path
      click_on 'New Announcement'
    end

    it "failure" do
      click_on "Create Announcement"
      page.should have_content("can't be blank")
    end
    
    it "success" do
      fill_in "Message", with: 'my new message'
      click_on "Create Announcement"
      page.should have_selector('h1', text: 'Administer Announcements')
      page.should have_content('my new message')
    end
  end
  
  describe 'update' do
    before(:each) do
      saved_current_announcement
      visit admin_announcements_path
      click_on 'edit'
    end

    it "failure" do
      fill_in "Message", with: ''
      click_on "Update Announcement"
      page.should have_content("can't be blank")
    end
    
    it "success" do
      fill_in "Message", with: 'my updated message'
      click_on "Update Announcement"
      page.should have_selector('h1', text: 'Administer Announcements')
      page.should have_content('my updated message')
    end
  end
  
  describe 'delete' do
    before(:each) do
      saved_current_announcement
      visit admin_announcements_path
      page.should have_content('current')
      click_on 'delete'
    end

    it "delete" do
      page.should_not have_content('current')
    end
    
  end
  
  describe 'table attributes' do
    before(:each) do
      saved_current_announcement
    end
    
    it "bootstrap" do
      visit admin_announcements_path(bootstrap: 'true')
      page.should have_selector('table.ua-table.bootstrap')
    end

    it "non-bootstrap" do
      visit admin_announcements_path(bootstrap: 'false')
      page.should have_selector('table.ua-table.non-bootstrap')
    end
  end
  
end
<commit_msg>fix controller spec<commit_after>require 'spec_helper'

describe Admin::AnnouncementsController, :type => :feature do
  before :each do
    create_and_login_user
  end

  it "index" do
    saved_current_announcement
    visit admin_announcements_path
    page.should have_selector('h1', text: 'Administer Announcements')
    page.should have_content('current')
  end
  
  describe 'create' do
    before(:each) do
      visit admin_announcements_path
      click_on 'New Announcement'
    end

    it "failure" do
      click_on "Create Announcement"
      page.should have_content("can't be blank")
    end
    
    it "success" do
      fill_in "Message", with: 'my new message'
      check 'Public'
      click_on "Create Announcement"
      page.should have_selector('h1', text: 'Administer Announcements')
      page.should have_content('my new message')
    end
  end
  
  describe 'update' do
    before(:each) do
      saved_current_announcement
      visit admin_announcements_path
      click_on 'edit'
    end

    it "failure" do
      fill_in "Message", with: ''
      click_on "Update Announcement"
      page.should have_content("can't be blank")
    end
    
    it "success" do
      fill_in "Message", with: 'my updated message'
      click_on "Update Announcement"
      page.should have_selector('h1', text: 'Administer Announcements')
      page.should have_content('my updated message')
    end
  end
  
  describe 'delete' do
    before(:each) do
      saved_current_announcement
      visit admin_announcements_path
      page.should have_content('current')
      click_on 'delete'
    end

    it "delete" do
      page.should_not have_content('current')
    end
    
  end
  
  describe 'table attributes' do
    before(:each) do
      saved_current_announcement
    end
    
    it "bootstrap" do
      visit admin_announcements_path(bootstrap: 'true')
      page.should have_selector('table.ua-table.bootstrap')
    end

    it "non-bootstrap" do
      visit admin_announcements_path(bootstrap: 'false')
      page.should have_selector('table.ua-table.non-bootstrap')
    end
  end
  
end

{'fraction_non_alphanumeric': 0.08271927739481816, 'fraction_numerical': 0.0014261944378416924, 'mean_word_length': 2.9290382819794583, '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': '7584758', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1288, 'n_words': 338}