Sha256: c8ad94ed3686fe4b12620ce6a972380af9ddfa8372d6ef9f2140518db6d38b26

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

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_all_returns_all_sets
    VCR.use_cassette('all_sets') do
      sets = MTG::Set.all
      
      assert sets.length > 100
    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-3.0.0 test/set_test.rb
mtg_sdk-2.2.0 test/set_test.rb
mtg_sdk-2.1.0 test/set_test.rb
mtg_sdk-2.0.1 test/set_test.rb
mtg_sdk-2.0.0 test/set_test.rb