<commit_before>require 'spec_helper'

feature "Contest air giveaway" do
  let(:user) { FactoryGirl.create(:user) }
  let!(:send_hour) {
    if Time.zone.now == 23
      1
    else
      (Time.zone.now.beginning_of_hour + 1.hour).hour
    end
  }

  let!(:today) {
    if Time.zone.now.hour == 23
      return Time.zone.tomorrow.beginning_of_day
    else
      return Time.zone.today
    end
  }

  let!(:venue) { FactoryGirl.create(:venue, name: "Variety Playhouse", send_hour: send_hour) }
  let!(:early_venue) { FactoryGirl.create(:venue, :send_early, name: "The Masquerade", send_hour: send_hour) }

  let!(:sent_contest) { FactoryGirl.create(:contest, :sent, venue: venue) }

  let!(:announceable_contests) {
    [
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today + 1.day)),
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today + 1.days))
    ]
  }

  let!(:unannounceable_contests) {
    [
      # sent contest
      FactoryGirl.create(:contest, :sent, venue: venue),
      # past contests
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today - 1.day)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today)),
      # over 2 weeks away
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today + 2.weeks)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today + 2.weeks + 1.day))
    ]
  }

  before(:each) do
    login_with user
    visit air_contests_path
  end

  scenario "User views contests" do
    expect(page).to have_selector('.panel', 2)

    announceable_contests.each do |contest|
      expect(page).to have_content(contest.event.name)
    end

    unannounceable_contests.each do |contest|
      expect(page).to_not have_content(contest.event.name)
    end
  end

  scenario "User views a contest"
    
  end

  scenario "User adds listener tickets"

  end

  scenario "User deletes a listener ticket"

  end
end
<commit_msg>fixing bad syntax in tests<commit_after>require 'spec_helper'

feature "Contest air giveaway" do
  let(:user) { FactoryGirl.create(:user) }
  let!(:send_hour) {
    if Time.zone.now == 23
      1
    else
      (Time.zone.now.beginning_of_hour + 1.hour).hour
    end
  }

  let!(:today) {
    if Time.zone.now.hour == 23
      return Time.zone.tomorrow.beginning_of_day
    else
      return Time.zone.today
    end
  }

  let!(:venue) { FactoryGirl.create(:venue, name: "Variety Playhouse", send_hour: send_hour) }
  let!(:early_venue) { FactoryGirl.create(:venue, :send_early, name: "The Masquerade", send_hour: send_hour) }

  let!(:sent_contest) { FactoryGirl.create(:contest, :sent, venue: venue) }

  let!(:announceable_contests) {
    [
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today + 1.day)),
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today + 1.days))
    ]
  }

  let!(:unannounceable_contests) {
    [
      # sent contest
      FactoryGirl.create(:contest, :sent, venue: venue),
      # past contests
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today - 1.day)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today)),
      # over 2 weeks away
      FactoryGirl.create(:contest, venue: venue,
        event: FactoryGirl.create(:event, start_time: today + 2.weeks)),
      FactoryGirl.create(:contest, venue: early_venue,
        event: FactoryGirl.create(:event, start_time: today + 2.weeks + 1.day))
    ]
  }

  before(:each) do
    login_with user
    visit air_contests_path
  end

  scenario "User views contests" do
    expect(page).to have_selector('.panel', 2)

    announceable_contests.each do |contest|
      expect(page).to have_content(contest.event.name)
    end

    unannounceable_contests.each do |contest|
      expect(page).to_not have_content(contest.event.name)
    end
  end

  scenario "User views a contest" do
    
  end

  scenario "User adds listener tickets" do

  end

  scenario "User deletes a listener ticket" do

  end
end

{'fraction_non_alphanumeric': 0.12117291936179388, 'fraction_numerical': 0.00603708495040966, 'mean_word_length': 3.279520295202952, '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': '6198877', 'n_tokens_mistral': 1595, 'n_tokens_neox': 1496, 'n_words': 337}