aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorZog2018-02-20 11:38:44 +0100
committerZog2018-02-20 14:32:41 +0100
commit05a60eb3e91915ae7192d67599cb3d47a2790507 (patch)
tree359ec1f46caf135ca1734e09848b20e084f3fea0 /spec/controllers
parenteed186f44ee13c73dd6ba3df78f72a89cde3d30d (diff)
downloadchouette-core-05a60eb3e91915ae7192d67599cb3d47a2790507.tar.bz2
Refs #5901; Update specs and fix unaccented search
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/autocomplete_time_tables_controller_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/controllers/autocomplete_time_tables_controller_spec.rb b/spec/controllers/autocomplete_time_tables_controller_spec.rb
index 5cc0eced0..85a8eb714 100644
--- a/spec/controllers/autocomplete_time_tables_controller_spec.rb
+++ b/spec/controllers/autocomplete_time_tables_controller_spec.rb
@@ -6,6 +6,8 @@ RSpec.describe AutocompleteTimeTablesController, type: :controller do
let(:referential) { Referential.first }
let(:other_referential) { create :referential }
let!(:time_table) { create :time_table, comment: 'écolà militaire' }
+ let!(:blargh) { create :time_table, comment: 'écolàë militaire' }
+ let!(:other_time_table) { create :time_table, comment: 'foo bar baz' }
describe 'GET #index' do
it 'should be successful' do
@@ -17,13 +19,17 @@ RSpec.describe AutocompleteTimeTablesController, type: :controller do
it 'should be successful' do
get :index, referential_id: referential.id, q: {unaccented_comment_or_objectid_cont_any: 'écolà'}, :format => :json
expect(response).to be_success
- expect(assigns(:time_tables)).to eq([time_table])
+ expect(assigns(:time_tables)).to include(time_table)
+ expect(assigns(:time_tables)).to include(blargh)
+ expect(assigns(:time_tables)).to_not include(other_time_table)
end
it 'should be accent insensitive' do
get :index, referential_id: referential.id, q: {unaccented_comment_or_objectid_cont_any: 'ecola'}, :format => :json
expect(response).to be_success
- expect(assigns(:time_tables)).to eq([time_table])
+ expect(assigns(:time_tables)).to include(time_table)
+ expect(assigns(:time_tables)).to include(blargh)
+ expect(assigns(:time_tables)).to_not include(other_time_table)
end
end
end