Sha256: 419665b38b330ea91cd799b92e3cbca283f9931c44d8d18732c4a4f0d3f084b6

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

require 'helper'

describe Fantasydata::API::Score do

  before do
    @client = new_test_client
  end

  describe '#scores_by_season' do
    before do
      stub_get("/nfl/v2/JSON/Scores/2012").
      to_return(:body => fixture("scores/by_season.json"),
                 :headers => {:content_type => "application/json; charset=utf-8"})
    end

    it "requests correct resource" do
      @client.scores_by_season(2012)
      expect(a_get("/nfl/v2/JSON/Scores/2012")).to have_been_made
    end

    it "returns scores" do
      scores = @client.scores_by_season(2012)

      expect(scores).to be_an Array
      expect(scores.first).to be_an Fantasydata::Score
      expect(scores.first.game_key).to eq '201210123'
      expect(scores.first.away_score_quarter3).to eq 10
    end
  end

  describe '#scores_by_week' do
    before do
      stub_get("/nfl/v2/JSON/ScoresByWeek/2012/11").
      to_return(:body => fixture("scores/by_week.json"),
                 :headers => {:content_type => "application/json; charset=utf-8"})
    end

    it "requests correct resource" do
      @client.scores_by_week(2012, 11)
      expect(a_get("/nfl/v2/JSON/ScoresByWeek/2012/11")).to have_been_made
    end

    it "returns scores" do
      scores = @client.scores_by_week(2012, 11)

      expect(scores).to be_an Array
      expect(scores.first).to be_an Fantasydata::Score
      expect(scores.first.game_key).to eq '201211104'
      expect(scores.first.away_score_quarter3).to eq 0
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fantasydata-0.2.2 spec/fantasydata/api/scores_spec.rb
fantasydata-0.2.1 spec/fantasydata/api/scores_spec.rb
fantasydata-0.2.0 spec/fantasydata/api/scores_spec.rb