<commit_before>require 'spec_helper'

describe GiftForm do
  context '.pull_requests_for_select' do
    it "formats pull requests for select boxes" do
      gifts = [mock('pr', :to_param => '1', :title => 'Foo', :gifted_state => :gifted)]
      pull_requests = stub(:includes => gifts, :sort => gifts)
      form = GiftForm.new(:gift => mock('gift'),
                          :pull_requests => pull_requests)

      form.pull_requests_for_select.should == [['Gifted: Foo', '1']]
    end
  end

  it "formats dates for select boxes" do
    dates = [Date.new(2012, 12, 1), Date.new(2012,12,2)]

    form = GiftForm.new(:gift => mock('gift'),
                        :pull_requests => mock('reqs'),
                        :giftable_dates => dates)

    form.giftable_dates.should == [['December 1st','2012-12-01'],
                                   ['December 2nd','2012-12-02']]
  end

  it "assumes that you don't want a date select if giftable_dates is nil" do
    form = GiftForm.new(:gift => mock('gift'),
                        :pull_requests => mock('reqs'))

    form.show_date_select?.should be_false
  end
end<commit_msg>Fix gift_form spec<commit_after>require 'spec_helper'

describe GiftForm do
  context '.pull_requests_for_select' do
    it "formats pull requests for select boxes" do
      gifts = [mock('pr', :to_param => '1', :title => 'Foo', :repo_name => 'Bar', :gifted_state => :gifted)]
      pull_requests = stub(:includes => gifts, :sort => gifts)
      form = GiftForm.new(:gift => mock('gift'),
                          :pull_requests => pull_requests)

      form.pull_requests_for_select.should == [['Gifted: Bar - Foo', '1']]
    end
  end

  it "formats dates for select boxes" do
    dates = [Date.new(2012, 12, 1), Date.new(2012,12,2)]

    form = GiftForm.new(:gift => mock('gift'),
                        :pull_requests => mock('reqs'),
                        :giftable_dates => dates)

    form.giftable_dates.should == [['December 1st','2012-12-01'],
                                   ['December 2nd','2012-12-02']]
  end

  it "assumes that you don't want a date select if giftable_dates is nil" do
    form = GiftForm.new(:gift => mock('gift'),
                        :pull_requests => mock('reqs'))

    form.show_date_select?.should be_false
  end
end
{'fraction_non_alphanumeric': 0.1441637630662021, 'fraction_numerical': 0.029616724738675958, 'mean_word_length': 2.464555052790347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687002', 'n_tokens_mistral': 797, 'n_tokens_neox': 714, 'n_words': 180}