From 2e2aa913757011386b4f72ef8e3b2a3bd66525fd Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 25 Jul 2017 16:00:43 +0200 Subject: [PATCH] Added cleanup of searchindex in test file. --- .../ticket/article/communicate_email/background_job.rb | 4 ++++ test/controllers/form_controller_test.rb | 6 ++++++ test/controllers/search_controller_test.rb | 6 ++++++ test/integration/elasticsearch_test.rb | 6 ++++++ test/integration/report_test.rb | 6 ++++++ 5 files changed, 28 insertions(+) diff --git a/app/models/observer/ticket/article/communicate_email/background_job.rb b/app/models/observer/ticket/article/communicate_email/background_job.rb index 7a3b3ce88..e3fdfb053 100644 --- a/app/models/observer/ticket/article/communicate_email/background_job.rb +++ b/app/models/observer/ticket/article/communicate_email/background_job.rb @@ -155,6 +155,10 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob updated_by_id: 1, created_by_id: 1, ) + + ticket = Ticket.find(local_record.ticket_id) + ticket.state = Ticket::State.find_by(default_follow_up: true) + ticket.save! end raise message diff --git a/test/controllers/form_controller_test.rb b/test/controllers/form_controller_test.rb index f3c8e3612..7637802d0 100644 --- a/test/controllers/form_controller_test.rb +++ b/test/controllers/form_controller_test.rb @@ -34,6 +34,12 @@ class FormControllerTest < ActionDispatch::IntegrationTest Rake::Task['searchindex:rebuild'].execute end + teardown do + if ENV['ES_URL'].present? + Rake::Task['searchindex:drop'].execute + end + end + test '01 - get config call' do post '/api/v1/form_config', {}.to_json, @headers assert_response(401) diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb index 2528238a2..dea48e6be 100644 --- a/test/controllers/search_controller_test.rb +++ b/test/controllers/search_controller_test.rb @@ -179,6 +179,12 @@ class SearchControllerTest < ActionDispatch::IntegrationTest end end + teardown do + if ENV['ES_URL'].present? + Rake::Task['searchindex:drop'].execute + end + end + test 'settings index with nobody' do params = { query: 'test 1234', diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index 1df367b88..6f7646b7d 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -100,6 +100,12 @@ class ElasticsearchTest < ActiveSupport::TestCase ) end + teardown do + if ENV['ES_URL'].present? + Rake::Task['searchindex:drop'].execute + end + end + # check search attributes test 'a - objects' do diff --git a/test/integration/report_test.rb b/test/integration/report_test.rb index 5a67ae0ba..90b52a714 100644 --- a/test/integration/report_test.rb +++ b/test/integration/report_test.rb @@ -250,6 +250,12 @@ class ReportTest < ActiveSupport::TestCase end + teardown do + if ENV['ES_URL'].present? + Rake::Task['searchindex:drop'].execute + end + end + test 'compare' do # first solution