<commit_before>require 'helper'

describe MtGox::Client do
  before do
    @client = MtGox::Client.new
  end

  describe '#ticker' do
    before do
      stub_get('/code/data/ticker.php').
        to_return(:status => 200, :body => fixture('ticker.json'))
    end

    it "should fetch the ticker" do
      ticker = @client.ticker
      a_get('/code/data/ticker.php').should have_been_made
      ticker.last.should == 26.5
    end
  end

  describe '#asks' do
    before do
      stub_get('/code/data/getDepth.php').
        to_return(:status => 200, :body => fixture('depth.json'))
    end

    it "should fetch open asks" do
      asks = @client.asks
      a_get('/code/data/getDepth.php').should have_been_made
      asks.last.should == [45, 593.28]
    end
  end

  describe '#bids' do
    before do
      stub_get('/code/data/getDepth.php').
        to_return(:status => 200, :body => fixture('depth.json'))
    end

    it "should fetch open bids" do
      bids = @client.bids
      a_get('/code/data/getDepth.php').should have_been_made
      bids.last.should == [19.1, 1]
    end
  end

  describe '#trades' do
    before do
      stub_get('/code/data/getTrades.php').
        to_return(:status => 200, :body => fixture('trades.json'))
    end

    it "should fetch trades" do
      trades = @client.trades
      a_get('/code/data/getTrades.php').should have_been_made
      trades.last.date.should == Time.local(2011, 6, 8, 2, 51, 57)
      trades.last.price.should == 26.6099
      trades.last.amount.should == 1.37
      trades.last.tid.should == "129606"
    end
  end
end<commit_msg>Test against a universal time, so tests pass in non-Pacific time zones<commit_after>require 'helper'

describe MtGox::Client do
  before do
    @client = MtGox::Client.new
  end

  describe '#ticker' do
    before do
      stub_get('/code/data/ticker.php').
        to_return(:status => 200, :body => fixture('ticker.json'))
    end

    it "should fetch the ticker" do
      ticker = @client.ticker
      a_get('/code/data/ticker.php').should have_been_made
      ticker.last.should == 26.5
    end
  end

  describe '#asks' do
    before do
      stub_get('/code/data/getDepth.php').
        to_return(:status => 200, :body => fixture('depth.json'))
    end

    it "should fetch open asks" do
      asks = @client.asks
      a_get('/code/data/getDepth.php').should have_been_made
      asks.last.should == [45, 593.28]
    end
  end

  describe '#bids' do
    before do
      stub_get('/code/data/getDepth.php').
        to_return(:status => 200, :body => fixture('depth.json'))
    end

    it "should fetch open bids" do
      bids = @client.bids
      a_get('/code/data/getDepth.php').should have_been_made
      bids.last.should == [19.1, 1]
    end
  end

  describe '#trades' do
    before do
      stub_get('/code/data/getTrades.php').
        to_return(:status => 200, :body => fixture('trades.json'))
    end

    it "should fetch trades" do
      trades = @client.trades
      a_get('/code/data/getTrades.php').should have_been_made
      trades.last.date.should == Time.utc(2011, 6, 8, 9, 51, 57)
      trades.last.price.should == 26.6099
      trades.last.amount.should == 1.37
      trades.last.tid.should == "129606"
    end
  end
end
{'fraction_non_alphanumeric': 0.1392054203880505, 'fraction_numerical': 0.032029565753002774, 'mean_word_length': 2.496232508073197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4979378', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1107, 'n_words': 256}