Sha256: db3519d809155ba10619a1cd727189484ff87dd13b28f28c5504aa8b67cff541

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

# encoding: utf-8


require 'helper'

### todo/fix: move to worlddb along with fixture matcher module!!

class TestFixtureMatchers < MiniTest::Unit::TestCase

  include BeerDb::FixtureMatcher


  def test_country

    beers_at = [
      'europe/at/beers',
      'europe/at-austria/beers',
      'at-austria/beers',
      'at-austria!/beers'
    ]

    beers_at.each do |name|
      found = match_beers_for_country( name ) do |country_key|
        assert( country_key == 'at')
      end
      assert( found == true )
    end

    breweries_at = [
      'europe/at/breweries',
      'europe/at-austria/breweries',
      'at-austria/breweries',
      'at-austria!/breweries'
    ]

    breweries_at.each do |name|
      found = match_breweries_for_country( name ) do |country_key|
        assert( country_key == 'at')
      end
      assert( found == true )
    end
  end # method test_country


  def test_country_n_region

    beers_at = [
      'europe/at-austria/w-wien/beers',
      'at-austria/w-wien/beers',
      'at-austria!/w-wien/beers'
    ]

    beers_at.each do |name|
      found = match_beers_for_country_n_region( name ) do |country_key,region_key|
        assert( country_key == 'at')
        assert( region_key  == 'w' )
      end
      assert( found == true )
    end

    breweries_at = [
      'europe/at-austria/w-wien/breweries',
      'at-austria/w-wien/breweries',
      'at-austria!/w-wien/breweries'
    ]

    breweries_at.each do |name|
      found = match_breweries_for_country_n_region( name ) do |country_key,region_key|
        assert( country_key == 'at')
        assert( region_key  == 'w' )
      end
      assert( found == true )
    end
  end # method test_country_n_region


end # class TestFixtureMatchers

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
beerdb-0.8.2 test/test_fixture_matchers.rb
beerdb-0.8.1 test/test_fixture_matchers.rb
beerdb-0.8.0 test/test_fixture_matchers.rb
beerdb-0.7.2 test/test_fixture_matchers.rb