Sha256: 9eaea6e128260038f606bced5f4b2149b1020b8d2c55b7bfc4b087379d029847

Contents?: true

Size: 921 Bytes

Versions: 5

Compression:

Stored size: 921 Bytes

Contents

require_relative 'test_helper'

class SetTest < Minitest::Test
  def test_find_returns_one_set
    VCR.use_cassette('one_set') do
      set = MTG::Set.find('ktk')
      
      assert_equal 'KTK', set.code
      assert_equal 'Khans of Tarkir', set.name
      assert_equal 'expansion', set.type
      assert_equal 'black', set.border
      assert set.booster.any? {|rarity| rarity == 'common'}
      assert_equal '2014-09-26', set.release_date
      assert_equal 'ktk', set.magic_cards_info_code
    end
  end
  
  def test_find_with_invalid_code_throws_exception
    VCR.use_cassette('invalid_code') do
      assert_raises ArgumentError do
        MTG::Set.find('invalid')
      end
    end
  end
  
  def test_generate_booster_returns_cards
    VCR.use_cassette('booster') do
      cards = MTG::Set.generate_booster('ktk')
      
      assert cards.length == 15
      assert_equal 'KTK', cards.first.set
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mtg_sdk-1.1.1 test/set_test.rb
mtg_sdk-1.1.0 test/set_test.rb
mtg_sdk-1.0.2 test/set_test.rb
mtg_sdk-1.0.1 test/set_test.rb
mtg_sdk-1.0.0 test/set_test.rb