]> git.openstreetmap.org Git - rails.git/blob - spec/controllers/api_controller_spec.rb
Mark map responses as attachments.
[rails.git] / spec / controllers / api_controller_spec.rb
1 require File.dirname(__FILE__) + '/../spec_helper'
2
3 module ApiMapHelpers
4   def self.included(klass)
5     klass.extend(ClassMethods)
6   end
7
8   def boundary_params(key)
9     case key
10       when :valid
11         '-0.3565352711206896,51.464740877658045,-0.2686446461206896,51.508686190158045'
12       when :min_lat_more_than_max_lat
13         '-0.3565352711206896,51.508686190158045,-0.2686446461206896,51.464740877658045'
14       when :min_lon_more_than_max_lon
15         '51.464740877658045,-0.2686446461206896,51.508686190158045,-0.3565352711206896'
16     end
17   end
18
19   module ClassMethods
20     def otherasdfa
21     end
22   end
23 end
24
25 describe "When accessing /api/0.5/map" do
26   controller_name :api
27   include ApiMapHelpers
28   
29   before(:each) do
30   end
31
32   it "should _return success_ with _correct boundary longitudes/latitudes_" do
33     get :map, :bbox => boundary_params(:valid)
34     response.should be_success
35   end
36
37   it "should return an _error_ when _minimum longitude more than or equal to maximum longitude_" do
38     get :map, :bbox => boundary_params(:min_lat_more_than_max_lat)
39     response.should_not be_success
40   end
41
42   it "should return an error unless minimum latitude less than maximum latitude" do
43     get :map, :bbox => boundary_params(:min_lon_more_than_max_lon)
44     response.should_not be_success
45   end
46
47   it "should return an error unless latitudes are between -90 and 90 degrees" do
48     pending
49   end
50
51   it "should return an error unless longitudes are between -180 and 180 degrees" do
52     pending
53   end
54   
55 end