diff options
| author | Teddy Wing | 2018-04-24 15:45:00 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-26 09:16:15 +0200 | 
| commit | 0becfb7afdc1e439059c1f82ef6860c1c52d7fd6 (patch) | |
| tree | 45702280f6f54b8d5b03c939bfd88b0e7bcb97cb /spec/controllers | |
| parent | 9c0013324b3dddb00c70b663a031b4ecf10e92c7 (diff) | |
| download | chouette-core-0becfb7afdc1e439059c1f82ef6860c1c52d7fd6.tar.bz2 | |
AutocompleteLinesController: Don't error if no `q` param is passed
Previously the action would respond with a 500 error if no `q` parameter
was given in the request. Instead, respond with a 200 and fix the error
that occurs as a result of assuming that `params[:q]` exists in
`AutocompleteLinesController#collection`.
Refs #5889
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/autocomplete_lines_controller_spec.rb | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/spec/controllers/autocomplete_lines_controller_spec.rb b/spec/controllers/autocomplete_lines_controller_spec.rb index d52cecd04..60dff5381 100644 --- a/spec/controllers/autocomplete_lines_controller_spec.rb +++ b/spec/controllers/autocomplete_lines_controller_spec.rb @@ -63,5 +63,13 @@ RSpec.describe AutocompleteLinesController, type: :controller do        expect(assigns(:lines).to_a).to eq([line])      end + +    it "doesn't error when no `q` is sent" do +      get :index, +        referential_id: referential.id + +      expect(assigns(:lines).to_a).to be_empty +      expect(response).to be_success +    end    end  end | 
