Sha256: a06800237bbb221453b5b50a509e12c417a716f62d12e8c087fea723576cff0c

Contents?: true

Size: 1013 Bytes

Versions: 1

Compression:

Stored size: 1013 Bytes

Contents

require 'test_helper'

describe TeamParser do
  before do
    @parser = TeamParser.new
  end

  after do
    @parser = nil
  end

  describe 'get_by_year' do
    it 'should get all the teams for year without schedule' do
      VCR.use_cassette('teams_without_schedule') do
        @parser.get_by_year(2014, false).count.must_equal 32
      end
    end

    it 'should get all the teams for year with schedule' do
      VCR.use_cassette('teams_with_schedule') do
        result = @parser.get_by_year(2014, true)
        result.count.must_equal 32
        result.each do |team|
          team[:schedule].count.must_equal 17 # includes bye weeks
        end
      end
    end

    it 'should use JAX as the abbreviation for Jacksonville' do
      VCR.use_cassette('teams_with_schedule') do
        result = @parser.get_by_year(2014, true)
        result.any? { |team| team[:short_name] == 'JAX' }.must_equal true
        result.none? { |team| team[:short_name] == 'JAC' }.must_equal true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nfl_data-0.0.14 test/nfl_data/parsers/team_parser_test.rb