elastic_record 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +3 -0
- data/Gemfile +2 -2
- data/Rakefile +16 -8
- data/elastic_record.gemspec +2 -2
- data/lib/elastic_record/index/configurator.rb +5 -1
- data/lib/elastic_record/index/percolator.rb +11 -6
- data/lib/elastic_record/index.rb +3 -0
- data/lib/elastic_record/relation/search_methods.rb +2 -4
- data/lib/elastic_record/tasks/index.rake +14 -2
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/project.rb +7 -0
- data/test/{support → dummy/app}/models/test_model.rb +0 -0
- data/test/{support → dummy/app}/models/warehouse.rb +0 -0
- data/test/{support → dummy/app}/models/widget.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +15 -0
- data/test/dummy/config/elasticsearch.yml +4 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/elastic_record.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/elastic_record/integration/active_record_test.rb +2 -12
- data/test/elastic_record/log_subscriber_test.rb +5 -5
- data/test/elastic_record/model_test.rb +1 -1
- data/test/elastic_record/relation/delegation_test.rb +1 -1
- data/test/elastic_record/relation/search_methods_test.rb +3 -3
- data/test/helper.rb +3 -10
- metadata +52 -8
- data/test/support/connect.rb +0 -1
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
# See how all your routes lay out with "rake routes".
|
4
|
+
|
5
|
+
# You can have the root of your site routed with "root"
|
6
|
+
# root 'welcome#index'
|
7
|
+
|
8
|
+
# Example of regular route:
|
9
|
+
# get 'products/:id' => 'catalog#view'
|
10
|
+
|
11
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
+
|
14
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
+
# resources :products
|
16
|
+
|
17
|
+
# Example resource route with options:
|
18
|
+
# resources :products do
|
19
|
+
# member do
|
20
|
+
# get 'short'
|
21
|
+
# post 'toggle'
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# collection do
|
25
|
+
# get 'sold'
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
|
29
|
+
# Example resource route with sub-resources:
|
30
|
+
# resources :products do
|
31
|
+
# resources :comments, :sales
|
32
|
+
# resource :seller
|
33
|
+
# end
|
34
|
+
|
35
|
+
# Example resource route with more complex sub-resources:
|
36
|
+
# resources :products do
|
37
|
+
# resources :comments
|
38
|
+
# resources :sales do
|
39
|
+
# get 'recent', on: :collection
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Example resource route with concerns:
|
44
|
+
# concern :toggleable do
|
45
|
+
# post 'toggle'
|
46
|
+
# end
|
47
|
+
# resources :posts, concerns: :toggleable
|
48
|
+
# resources :photos, concerns: :toggleable
|
49
|
+
|
50
|
+
# Example resource route within a namespace:
|
51
|
+
# namespace :admin do
|
52
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
+
# # (app/controllers/admin/products_controller.rb)
|
54
|
+
# resources :products
|
55
|
+
# end
|
56
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: ca7d67ffee322e0c4c558ca5350677898479785fcb3fa59b3c23320505d206b72532283d889d31ced4c3206f9ac18004d20585cd73cb27376a355486e23a5e9c
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 297de5b386269e25231f6b8895feda7388b5c6c1bc19716ab6dd9c24931bf55df684a2feb7cc048ba0e34864d59264b1995f2004fb2e6bc721caa3a3c9493f21
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 0) do
|
15
|
+
|
16
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -1,18 +1,8 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
require 'active_record'
|
4
|
-
|
5
3
|
require 'mysql2'
|
6
4
|
require 'pg'
|
7
5
|
|
8
|
-
class Project < ActiveRecord::Base
|
9
|
-
include ElasticRecord::Model
|
10
|
-
|
11
|
-
self.elastic_index.mapping[:properties].update(
|
12
|
-
name: { type: 'string', index: 'not_analyzed' }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
6
|
module ElasticRecord
|
17
7
|
module ActiveRecordIntegration
|
18
8
|
def setup_project_database(config)
|
@@ -20,7 +10,7 @@ module ElasticRecord
|
|
20
10
|
ActiveRecord::Tasks::DatabaseTasks.create config
|
21
11
|
ActiveRecord::Base.establish_connection config
|
22
12
|
|
23
|
-
|
13
|
+
ActiveRecord::Migration.suppress_messages do
|
24
14
|
ActiveRecord::Migration.create_table :projects do |t|
|
25
15
|
t.string :name, null: false
|
26
16
|
end
|
@@ -79,4 +69,4 @@ class ElasticRecord::PostgresqlTest < MiniTest::Test
|
|
79
69
|
'password' => ''
|
80
70
|
)
|
81
71
|
end
|
82
|
-
end
|
72
|
+
end
|
@@ -17,23 +17,23 @@ class ElasticRecord::LogSubscriberTest < ActiveSupport::TestCase
|
|
17
17
|
|
18
18
|
def test_request_notification
|
19
19
|
FakeWeb.register_uri(:any, %r[/test], status: ["200", "OK"], body: ActiveSupport::JSON.encode('the' => 'response'))
|
20
|
-
Widget.elastic_connection.json_get "/
|
20
|
+
Widget.elastic_connection.json_get "/widgets", {'foo' => 'bar'}
|
21
21
|
|
22
22
|
wait
|
23
23
|
|
24
24
|
assert_equal 1, @logger.logged(:debug).size
|
25
|
-
assert_match /GET (.*)
|
25
|
+
assert_match /GET (.*)widgets/, @logger.logged(:debug)[0]
|
26
26
|
assert_match %r['#{ActiveSupport::JSON.encode('foo' => 'bar')}'], @logger.logged(:debug)[0]
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_request_notification_escaping
|
30
|
-
FakeWeb.register_uri(:any, %r[/
|
31
|
-
Widget.elastic_connection.json_get "/
|
30
|
+
FakeWeb.register_uri(:any, %r[/widgets?v=%DB], status: ["200", "OK"], body: ActiveSupport::JSON.encode('the' => 'response', 'has %DB' => 'odd %DB stuff'))
|
31
|
+
Widget.elastic_connection.json_get "/widgets?v=%DB", {'foo' => 'bar', 'escape %DB ' => 'request %DB'}
|
32
32
|
|
33
33
|
wait
|
34
34
|
|
35
35
|
assert_equal 1, @logger.logged(:debug).size
|
36
|
-
assert_match /GET (.*)
|
36
|
+
assert_match /GET (.*)widgets/, @logger.logged(:debug)[0]
|
37
37
|
assert_match %r['#{ActiveSupport::JSON.encode('foo' => 'bar', 'escape %DB ' => 'request %DB')}'], @logger.logged(:debug)[0]
|
38
38
|
end
|
39
39
|
|
@@ -8,7 +8,7 @@ class ElasticRecord::ModelTest < MiniTest::Test
|
|
8
8
|
connection = Widget.elastic_connection
|
9
9
|
|
10
10
|
assert_equal ElasticRecord::Config.servers, connection.servers
|
11
|
-
assert_equal ElasticRecord::Config.connection_options, connection.options
|
11
|
+
assert_equal ElasticRecord::Config.connection_options.symbolize_keys, connection.options
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_elastic_relation
|
@@ -21,7 +21,7 @@ class ElasticRecord::Relation::DelegationTest < MiniTest::Test
|
|
21
21
|
|
22
22
|
result = model.elastic_relation.filter('foo' => 'bar').do_it
|
23
23
|
|
24
|
-
expected = {"query" => {"
|
24
|
+
expected = {"query" => {"filtered" => {"filter" => {"term" => {"foo" => "bar"}}}}}
|
25
25
|
assert_equal expected, result
|
26
26
|
end
|
27
27
|
end
|
@@ -12,7 +12,7 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
12
12
|
relation.filter!(Widget.arelastic['faz'].in ['baz', 'fum'])
|
13
13
|
|
14
14
|
expected = {
|
15
|
-
"
|
15
|
+
"filtered" => {
|
16
16
|
"filter" => {
|
17
17
|
"and" => [
|
18
18
|
{"term" => {"foo" => "bar"}},
|
@@ -29,7 +29,7 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
29
29
|
relation.filter!(Widget.arelastic['faz'].in 3..5)
|
30
30
|
|
31
31
|
expected = {
|
32
|
-
"
|
32
|
+
"filtered" => {
|
33
33
|
"filter" => {
|
34
34
|
"range" => {
|
35
35
|
"faz" => {"gte"=>3, "lte"=>5}
|
@@ -45,7 +45,7 @@ class ElasticRecord::Relation::SearchMethodsTest < MiniTest::Test
|
|
45
45
|
relation.filter!("prefix" => {"name" => "Jo"})
|
46
46
|
|
47
47
|
expected = {
|
48
|
-
"
|
48
|
+
"filtered" => {
|
49
49
|
"filter" => {
|
50
50
|
"prefix" => {
|
51
51
|
"name" => "Jo"
|
data/test/helper.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
|
2
|
-
Bundler.require
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
3
2
|
|
4
|
-
require
|
5
|
-
|
6
|
-
require 'support/connect'
|
7
|
-
require 'support/models/test_model'
|
8
|
-
require 'support/models/warehouse'
|
9
|
-
require 'support/models/widget'
|
3
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
10
4
|
|
11
|
-
|
5
|
+
require 'minitest/autorun'
|
12
6
|
|
13
7
|
FakeWeb.allow_net_connect = %r[^https?://127.0.0.1]
|
14
8
|
|
@@ -18,7 +12,6 @@ module MiniTest
|
|
18
12
|
FakeWeb.clean_registry
|
19
13
|
|
20
14
|
ElasticRecord::Config.models.each do |model|
|
21
|
-
model.elastic_index.create_and_deploy if model.elastic_index.all_names.empty?
|
22
15
|
model.elastic_index.enable_deferring!
|
23
16
|
end
|
24
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infogroup
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arelastic
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.7.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.7.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activemodel
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +83,54 @@ files:
|
|
83
83
|
- lib/elastic_record/relation/value_methods.rb
|
84
84
|
- lib/elastic_record/searching.rb
|
85
85
|
- lib/elastic_record/tasks/index.rake
|
86
|
+
- test/dummy/README.rdoc
|
87
|
+
- test/dummy/Rakefile
|
88
|
+
- test/dummy/app/assets/images/.keep
|
89
|
+
- test/dummy/app/assets/javascripts/application.js
|
90
|
+
- test/dummy/app/assets/stylesheets/application.css
|
91
|
+
- test/dummy/app/controllers/application_controller.rb
|
92
|
+
- test/dummy/app/controllers/concerns/.keep
|
93
|
+
- test/dummy/app/helpers/application_helper.rb
|
94
|
+
- test/dummy/app/mailers/.keep
|
95
|
+
- test/dummy/app/models/.keep
|
96
|
+
- test/dummy/app/models/concerns/.keep
|
97
|
+
- test/dummy/app/models/project.rb
|
98
|
+
- test/dummy/app/models/test_model.rb
|
99
|
+
- test/dummy/app/models/warehouse.rb
|
100
|
+
- test/dummy/app/models/widget.rb
|
101
|
+
- test/dummy/app/views/layouts/application.html.erb
|
102
|
+
- test/dummy/bin/bundle
|
103
|
+
- test/dummy/bin/rails
|
104
|
+
- test/dummy/bin/rake
|
105
|
+
- test/dummy/bin/setup
|
106
|
+
- test/dummy/config.ru
|
107
|
+
- test/dummy/config/application.rb
|
108
|
+
- test/dummy/config/boot.rb
|
109
|
+
- test/dummy/config/database.yml
|
110
|
+
- test/dummy/config/elasticsearch.yml
|
111
|
+
- test/dummy/config/environment.rb
|
112
|
+
- test/dummy/config/environments/development.rb
|
113
|
+
- test/dummy/config/environments/production.rb
|
114
|
+
- test/dummy/config/environments/test.rb
|
115
|
+
- test/dummy/config/initializers/assets.rb
|
116
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
117
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
118
|
+
- test/dummy/config/initializers/elastic_record.rb
|
119
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
120
|
+
- test/dummy/config/initializers/inflections.rb
|
121
|
+
- test/dummy/config/initializers/mime_types.rb
|
122
|
+
- test/dummy/config/initializers/session_store.rb
|
123
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
124
|
+
- test/dummy/config/locales/en.yml
|
125
|
+
- test/dummy/config/routes.rb
|
126
|
+
- test/dummy/config/secrets.yml
|
127
|
+
- test/dummy/db/schema.rb
|
128
|
+
- test/dummy/lib/assets/.keep
|
129
|
+
- test/dummy/log/.keep
|
130
|
+
- test/dummy/public/404.html
|
131
|
+
- test/dummy/public/422.html
|
132
|
+
- test/dummy/public/500.html
|
133
|
+
- test/dummy/public/favicon.ico
|
86
134
|
- test/elastic_record/callbacks_test.rb
|
87
135
|
- test/elastic_record/config_test.rb
|
88
136
|
- test/elastic_record/connection_test.rb
|
@@ -109,10 +157,6 @@ files:
|
|
109
157
|
- test/elastic_record/relation_test.rb
|
110
158
|
- test/elastic_record/searching_test.rb
|
111
159
|
- test/helper.rb
|
112
|
-
- test/support/connect.rb
|
113
|
-
- test/support/models/test_model.rb
|
114
|
-
- test/support/models/warehouse.rb
|
115
|
-
- test/support/models/widget.rb
|
116
160
|
homepage: http://github.com/data-axle/elastic_record
|
117
161
|
licenses:
|
118
162
|
- MIT
|
data/test/support/connect.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ElasticRecord::Config.servers = '127.0.0.1:9200'
|