Commit e1b76e5abe7ef6bf63d421864d5737f822f787b8
1 parent
9d335fbd
Exists in
elasticsearch_api
Test redirect for elasticsearch plugin.
- Related with #322
Showing
3 changed files
with
22 additions
and
5 deletions
Show diff stats
plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb
plugins/elasticsearch/lib/elasticsearch_plugin.rb
plugins/elasticsearch/test/unit/controllers/elasticsearch_plugin_controller_test.rb
... | ... | @@ -7,6 +7,12 @@ class ElasticsearchPluginControllerTest < ActionController::TestCase |
7 | 7 | @environment.enable_plugin(ElasticsearchPlugin) |
8 | 8 | create_user('John Silva').person |
9 | 9 | create_user('John Silvio').person |
10 | + community = fast_create(Community) | |
11 | + community.name = "I like organic" | |
12 | + community.created_at = Time.now | |
13 | + community.save | |
14 | + Community.import | |
15 | + sleep 1 | |
10 | 16 | |
11 | 17 | #TODO: fix this, when update or create a new person |
12 | 18 | # the Elasticsearch::Model can update the |
... | ... | @@ -37,4 +43,20 @@ class ElasticsearchPluginControllerTest < ActionController::TestCase |
37 | 43 | assert_select ".search-item" , 1 |
38 | 44 | end |
39 | 45 | |
46 | + should 'redirect to elasticsearch plugin when request are send to core' do | |
47 | + oldcontroller = @controller | |
48 | + @controller = SearchController.new | |
49 | + get 'index' | |
50 | + params = {} | |
51 | + params[:action] = 'index' | |
52 | + params[:controller] = 'search' | |
53 | + assert_redirected_to controller: 'elasticsearch_plugin', action: 'search', params: params | |
54 | + @controller = oldcontroller | |
55 | + end | |
56 | + | |
57 | + should 'pass params to elastic search controller' do | |
58 | + get 'index', { query: 'like' } | |
59 | + assert_not_nil assigns(:results) | |
60 | + assert_template partial: '_community_display' | |
61 | + end | |
40 | 62 | end | ... | ... |