<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'helper'

include Helper


# a = Account.new
# a.register_call(call)
# a.bill                              -> current month bill
# a.bill(:month => 4, :year => 2011)  -> bill for april
# a.bill(:zone => Zone::LOCAL)        -> Bill for current month and local type
describe Account do

  def rate_for(start_time, zone, spec_rate)
    context "for a #{zone} call at #{start_time.hour}" do
      before { @call = Call.new(:start => start_time, :end => start_time + 60, :zone => zone) }
      it { Rate.calculate(@call).should == spec_rate }
    end
  end

  def load_calls
    calls = []
    calls << build_call(1, :start_time => hour(9)) << # 0.20
      build_call(5, :start_time => hour(7)) <<        # 5 * 0.10: 0.5
      build_call(1, :start_time => hour(21)) <<       # 0.10
      build_call(1, :day => :sunday) <<               # 0.10
      build_call(1, :day => :saturday) <<             # 0.10
      build_call(1, :zone => Zone::NATIONAL) <<       # 0.30
      build_call(1, :zone => Zone::SOUTH_AMERICA) <<  # 0.5
      build_call(1, :zone => Zone::NORTH_AMERICA) <<  # 0.7
      build_call(1, :zone => Zone::EUROPE) <<         # 0.7
      build_call(1, :zone => Zone::ELSEWHERE)         # 0.7  => total: 3.9
  end

  describe "#new" do
    subject { Account.new }
    its(:calls) { should be_empty }
    it { subject.bill(8,2011).should equal Rate::BASE_PAYMENT }
#    its(:bill) { should equal Rate::BASE_PAYMENT }

    describe "#register_call" do
      before do
        @account = Account.new
        @account.register_call Call.new(:start => Time.now - 120, :end => Time.now)
      end
      subject { @account }
      its(:calls) { should have(1).items }
      it { subject.bill(8, 2011).should  > Rate::BASE_PAYMENT }
#      its(:bill) { should > Rate::BASE_PAYMENT }
    end
  end<commit_msg>Se ajusta un test que estaba relacionado con la fecha actual. Pasa a fijarse la fecha<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'helper'

include Helper


# a = Account.new
# a.register_call(call)
# a.bill                              -> current month bill
# a.bill(:month => 4, :year => 2011)  -> bill for april
# a.bill(:zone => Zone::LOCAL)        -> Bill for current month and local type
describe Account do

  def rate_for(start_time, zone, spec_rate)
    context "for a #{zone} call at #{start_time.hour}" do
      before { @call = Call.new(:start => start_time, :end => start_time + 60, :zone => zone) }
      it { Rate.calculate(@call).should == spec_rate }
    end
  end

  def load_calls
    calls = []
    calls << build_call(1, :start_time => hour(9)) << # 0.20
      build_call(5, :start_time => hour(7)) <<        # 5 * 0.10: 0.5
      build_call(1, :start_time => hour(21)) <<       # 0.10
      build_call(1, :day => :sunday) <<               # 0.10
      build_call(1, :day => :saturday) <<             # 0.10
      build_call(1, :zone => Zone::NATIONAL) <<       # 0.30
      build_call(1, :zone => Zone::SOUTH_AMERICA) <<  # 0.5
      build_call(1, :zone => Zone::NORTH_AMERICA) <<  # 0.7
      build_call(1, :zone => Zone::EUROPE) <<         # 0.7
      build_call(1, :zone => Zone::ELSEWHERE)         # 0.7  => total: 3.9
  end

  describe "#new" do
    subject { Account.new }
    its(:calls) { should be_empty }
    it { subject.bill(8,2011).should equal Rate::BASE_PAYMENT }
#    its(:bill) { should equal Rate::BASE_PAYMENT }

    describe "#register_call" do
      before do
        @account = Account.new
        @account.register_call Call.new(:start => hour(20) - 120, :end => hour(20))
      end
      subject { @account }
      its(:calls) { should have(1).items }
      it { subject.bill(8, 2011).should  > Rate::BASE_PAYMENT }
#      its(:bill) { should > Rate::BASE_PAYMENT }
    end
  end
{'fraction_non_alphanumeric': 0.15502070393374742, 'fraction_numerical': 0.035196687370600416, 'mean_word_length': 2.478847884788479, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 51, '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': '3473403', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1332, 'n_words': 318}