<commit_before>require 'spec_helper'

describe "Exchange::Currency" do
  subject { Exchange::Currency.new(40, :usd) }
  before(:all) do
    Exchange::Configuration.define do |c|
      c.api = :currency_bot
      c.cache = false
    end
  end
  after(:all) do
    Exchange::Configuration.cache = :memcached
  end
  it "should initialize with a number and a currency" do
    subject.value.should == 40
    subject.currency.should == :usd
  end
  describe "convert_to" do
    it "should be able to convert itself to other currencies" do
      mock_api("http://openexchangerates.org/api/latest.json?app_id=", fixture('api_responses/example_json_api.json'), 3)
      subject.convert_to(:chf).value.round(2).should == 36.5
      subject.convert_to(:chf).currency.should == :chf
      subject.convert_to(:chf).should be_kind_of Exchange::Currency<commit_msg>! and yet another spec leak<commit_after>require 'spec_helper'

describe "Exchange::Currency" do
  subject { Exchange::Currency.new(40, :usd) }
  before(:all) do
    Exchange::Configuration.define do |c|
      c.api = :currency_bot
      c.cache = false
    end
  end
  after(:all) do
    Exchange::Configuration.define do |c|
      c.api = :xavier_media
      c.cache = :memcached
    end
  end
  it "should initialize with a number and a currency" do
    subject.value.should == 40
    subject.currency.should == :usd
  end
  describe "convert_to" do
    it "should be able to convert itself to other currencies" do
      mock_api("http://openexchangerates.org/api/latest.json?app_id=", fixture('api_responses/example_json_api.json'), 3)
      subject.convert_to(:chf).value.round(2).should == 36.5
      subject.convert_to(:chf).currency.should == :chf
      subject.convert_to(:chf).should be_kind_of Exchange::Currency
{'fraction_non_alphanumeric': 0.12006764374295378, 'fraction_numerical': 0.010146561443066516, 'mean_word_length': 3.658792650918635, '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': '4601694', 'n_tokens_mistral': 583, 'n_tokens_neox': 568, 'n_words': 136}