Skip to content

Commit ea4cc69

Browse files
author
Ferdinando Primerano
committed
Fix and add more tests
1 parent 610efd9 commit ea4cc69

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/api/v3/protected_areas_test.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,17 @@ def test_get_protected_areas_search_with_marine_returns_marine_pas
8383
assert_equal("Darjeeling", @json_response["protected_areas"][0]["name"])
8484
end
8585

86-
def test_get_protected_areas_search_with_marine_returns_marine_pas
86+
def test_get_protected_areas_with_mrine_unset_returns_all_pas
87+
create(:protected_area, name: "Darjeeling", marine: true)
88+
create(:protected_area, name: "Not Marine", marine: false)
89+
90+
get_with_rabl "/v3/protected_areas"
91+
92+
assert last_response.ok?
93+
assert_equal(2, @json_response["protected_areas"].size)
94+
end
95+
96+
def test_get_protected_areas_search_with_is_green_list_returns_green_listed_pas
8797
create(:protected_area, name: "Darjeeling", is_green_list: true)
8898
create(:protected_area, name: "Not Marine", is_green_list: false)
8999

@@ -94,6 +104,16 @@ def test_get_protected_areas_search_with_marine_returns_marine_pas
94104
assert_equal("Darjeeling", @json_response["protected_areas"][0]["name"])
95105
end
96106

107+
def test_get_protected_areas_with_is_green_list_unset_returns_all_pas
108+
create(:protected_area, name: "Darjeeling", is_green_list: true)
109+
create(:protected_area, name: "Not Marine", is_green_list: false)
110+
111+
get_with_rabl "/v3/protected_areas"
112+
113+
assert last_response.ok?
114+
assert_equal(2, @json_response["protected_areas"].size)
115+
end
116+
97117
def test_get_protected_areas_search_wants_at_least_one_param
98118
get_with_rabl "/v3/protected_areas/search", {}
99119
refute last_response.ok?

0 commit comments

Comments
 (0)