aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorTeddy Wing2018-04-25 16:00:17 +0200
committerJohan Van Ryseghem2018-04-26 15:35:54 +0200
commit86eb5008e14dfc2d4471aaf409de813f5840e7ac (patch)
treeb576ffdd188c819256941e8aa45406c4c9fc0173 /spec/controllers
parent1aeb36eb62d6cae25c40f3a99ff442fa9fe965fb (diff)
downloadchouette-core-86eb5008e14dfc2d4471aaf409de813f5840e7ac.tar.bz2
StopAreas#index: Filter by registration number
The input that filters by name and objectid now also needs to filter by registration number. Refs #6681
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/stop_areas_controller_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/stop_areas_controller_spec.rb b/spec/controllers/stop_areas_controller_spec.rb
index f39ac5776..a67b0e2e6 100644
--- a/spec/controllers/stop_areas_controller_spec.rb
+++ b/spec/controllers/stop_areas_controller_spec.rb
@@ -4,6 +4,31 @@ RSpec.describe StopAreasController, :type => :controller do
let(:stop_area_referential) { create :stop_area_referential, member: @user.organisation }
let(:stop_area) { create :stop_area, stop_area_referential: stop_area_referential }
+ describe "GET index" do
+ it "filters by registration number" do
+ registration_number = 'E34'
+
+ matched = create(
+ :stop_area,
+ stop_area_referential: stop_area_referential,
+ registration_number: registration_number
+ )
+ create(
+ :stop_area,
+ stop_area_referential: stop_area_referential,
+ registration_number: "doesn't match"
+ )
+
+ get :index,
+ stop_area_referential_id: stop_area_referential.id,
+ q: {
+ name_or_objectid_or_registration_number_cont: registration_number
+ }
+
+ expect(assigns(:stop_areas)).to eq([matched])
+ end
+ end
+
describe 'PUT deactivate' do
let(:request){ put :deactivate, id: stop_area.id, stop_area_referential_id: stop_area_referential.id }