Class: Mcll4rTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/mcll4r/mcll4r_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



6
7
8
# File 'lib/mcll4r/mcll4r_test.rb', line 6

def setup
  @mcll4r = Mcll4r.new
end

#test_assert_raise_on_district_not_foundObject



29
30
31
32
33
# File 'lib/mcll4r/mcll4r_test.rb', line 29

def test_assert_raise_on_district_not_found
  assert_raise DistrictNotFound do
    @mcll4r.district_lookup( 1.0, 1.0 )
  end
end

#test_assert_raise_on_errorObject



23
24
25
26
27
# File 'lib/mcll4r/mcll4r_test.rb', line 23

def test_assert_raise_on_error
  assert_raise DistrictNotFound do
    @mcll4r.district_lookup(nil,nil)
  end
end

#test_assert_we_get_back_correct_district_dataObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mcll4r/mcll4r_test.rb', line 10

def test_assert_we_get_back_correct_district_data
  expected = {
    "response"      => {                                                                   
      "state_upper" => { "district" => "029", "display_name" => "TX 29th", "state" => "TX" },
      "federal"     => { "district" => "16",  "display_name" => "TX 16th", "state" => "TX" },
      "state_lower" => { "district" => "077", "display_name" => "TX 77th", "state" => "TX" },
      "lng"         => "-106.490969",                                                      
      "lat"         => "31.76321"                                                          
    }                                                                                      
  }
  assert_equal expected, @mcll4r.district_lookup(31.76321, -106.490969)
end