Sha256: f385dcd12239ca64a0d02a6504986853c9cbeb905a3d264fcb0701fe96162c07
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'test_helper' class CsvDictionaryTest < Test::Unit::TestCase def setup CsvDictionaryTestHelper.setup_database @dictionary = CsvDictionary.new(:bts_aircraft_type, :url => GDOCS_URL, :sheet => 1) end def teardown Aircraft.clear_csv_dictionaries CsvDictionaryTestHelper.teardown_database end def test_should_set_key_name assert_equal :bts_aircraft_type, @dictionary.key_name end def test_should_set_url assert_equal GDOCS_URL, @dictionary.url end def test_should_set_zero_based_sheet assert_equal 0, @dictionary.sheet end def test_should_interpret_gdocs_urls assert_equal GDOCS_URL + '&output=csv&gid=0', @dictionary.send(:interpret_url, @dictionary.url) end def test_should_raise_if_gdocs_url_includes_gid assert_raise RuntimeError do CsvDictionary.new(:bts_aircraft_type, :url => GDOCS_URL + '&gid=1') end end def test_should_raise_if_sheet_option_set_on_non_gdocs_url assert_raise RuntimeError do CsvDictionary.new(:bts_aircraft_type, :url => CSV_URL, :sheet => 1) end end def test_should_replace_attributes attributes = { :bts_aircraft_type => '103' } @dictionary.expects(:lookup).with('103').returns('SJ') @dictionary.replace_attributes!(attributes) assert_equal({ :brighter_planet_aircraft_class_code => 'SJ' }, attributes) end # real http call def test_should_set_value_name_after_dictionary_loaded @dictionary.send(:load_dictionary) assert_equal :brighter_planet_aircraft_class_code, @dictionary.value_name end # real http call def test_should_lookup assert_equal 'SJ', @dictionary.lookup('103') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
seamusabshere-csv_dictionary-0.0.2 | test/csv_dictionary_test.rb |
seamusabshere-csv_dictionary-0.0.3 | test/csv_dictionary_test.rb |