<commit_before>require 'spec_helper'

describe Lbank do

  it "should return currency rates" do
    currency_rates = subject.currency_rates

    currency_rates['USD'].should be > 0
  end

  it "should convert currency" do
    subject.convert_currency(10, 'LTL', 'EUR').should be > 0

    date = Date.new(2012, 8, 4)

    subject.convert_currency(10, 'LTL', 'EUR', date).round(2).should == 2.90
    subject.convert_currency(10, 'LTL', 'USD', date).round(2).should == 3.55
    subject.convert_currency(100, 'RUB', 'LTL', date).round(2).should == 8.68
    subject.convert_currency(100, 'RUB', 'USD', date).round(2).should == 3.08
  end

end<commit_msg>Fixing tests for jruby and Rubinius<commit_after>require 'spec_helper'

describe Lbank do

  it "should return currency rates" do
    currency_rates = subject.currency_rates

    currency_rates['USD'].should be > 0
  end

  it "should convert currency" do
    subject.convert_currency(10, 'LTL', 'EUR').should be > 0

    date = Date.new(2012, 8, 4)

    round(subject.convert_currency(10, 'LTL', 'EUR', date)).should == 2.90
    round(subject.convert_currency(10, 'LTL', 'USD', date)).should == 3.55
    round(subject.convert_currency(100, 'RUB', 'LTL', date)).should == 8.68
    round(subject.convert_currency(100, 'RUB', 'USD', date)).should == 3.08
  end

  private

  def round(number, precision = 2)
    ("%.#{precision}f" % number).to_f
  end

end
{'fraction_non_alphanumeric': 0.15324305060584462, 'fraction_numerical': 0.04918032786885246, 'mean_word_length': 3.978723404255319, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3579937', 'n_tokens_mistral': 549, 'n_tokens_neox': 476, 'n_words': 118}