aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorZog2017-12-26 11:23:53 +0100
committerZog2017-12-26 11:23:53 +0100
commitd3445d085b607544dc6355956cd228835258d612 (patch)
tree62588979f26e42e1cbbffab91690256281008b1c /spec/controllers
parent9fe0ca13d7caba486561f52557c1fa3d2f9f0a52 (diff)
downloadchouette-core-d3445d085b607544dc6355956cd228835258d612.tar.bz2
Refs #5382 @1h; Enable all area types for Stopareas in Routes
Given that the organisation has the matching feature.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/autocomplete_stop_areas_controller_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/autocomplete_stop_areas_controller_spec.rb b/spec/controllers/autocomplete_stop_areas_controller_spec.rb
index 50fc877dd..2af471361 100644
--- a/spec/controllers/autocomplete_stop_areas_controller_spec.rb
+++ b/spec/controllers/autocomplete_stop_areas_controller_spec.rb
@@ -5,6 +5,8 @@ RSpec.describe AutocompleteStopAreasController, type: :controller do
let(:referential) { Referential.first }
let!(:stop_area) { create :stop_area, name: 'écolà militaire' }
+ let!(:zdep_stop_area) { create :stop_area, area_type: "zdep" }
+ let!(:not_zdep_stop_area) { create :stop_area, area_type: "lda" }
describe 'GET #index' do
it 'should be successful' do
@@ -26,4 +28,26 @@ RSpec.describe AutocompleteStopAreasController, type: :controller do
end
end
end
+
+ context "when searching from the route editor" do
+ let(:scope) { :route_editor }
+ let(:request){
+ get :index, referential_id: referential.id, scope: scope
+ }
+ it "should filter stop areas based on type" do
+ request
+ expect(assigns(:stop_areas)).to include(zdep_stop_area)
+ expect(assigns(:stop_areas)).to_not include(not_zdep_stop_area)
+ end
+
+ with_feature :route_stop_areas_all_types do
+ it "should not filter stop areas based on type" do
+ request
+ expect(assigns(:stop_areas)).to include(zdep_stop_area)
+ expect(assigns(:stop_areas)).to include(not_zdep_stop_area)
+ end
+ end
+ end
+
+
end