middleware_autocomplete 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/middleware_autocomplete.rb +23 -3
- data/lib/middleware_autocomplete/base.rb +40 -23
- data/lib/middleware_autocomplete/engine.rb +1 -1
- data/lib/middleware_autocomplete/router.rb +2 -6
- data/lib/middleware_autocomplete/url_helpers.rb +18 -0
- data/lib/middleware_autocomplete/version.rb +1 -1
- data/test/dummy/app/autocompletes/posts_autocomplete.rb +2 -1
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20140414220337_create_posts.rb +9 -0
- data/test/dummy/db/schema.rb +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +10 -0
- data/test/dummy/log/test.log +455 -0
- data/test/dummy/test/fixtures/posts.yml +8 -0
- data/test/integration/navigation_test.rb +16 -4
- data/test/middleware_autocomplete_test.rb +4 -0
- data/test/test_helper.rb +9 -3
- metadata +39 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83b22cefcf7c585981197dd1fb72555e155f6476
|
4
|
+
data.tar.gz: 4078dd93c6872ee571d2a1438d5e6030d2c230b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce20706fbe73f88a928e062ec33ab36c04787e3788f394899ac8ce10f9749cfa24a1ac135f4b4745bdfde4e0654231a61354a7f5fb5783386acb79e85f42160d
|
7
|
+
data.tar.gz: 0dd638df1356dfbafcf5ddccd39da9de96e314fd944e8b298dba4c8564a2574b70053af18e0945d72eb9457fe80a2f0b528fed8fbb5124e49b586611a68e9ccc
|
@@ -1,16 +1,36 @@
|
|
1
1
|
require "middleware_autocomplete/engine"
|
2
2
|
|
3
3
|
module MiddlewareAutocomplete
|
4
|
-
autoload :Base,
|
5
|
-
autoload :Router,
|
4
|
+
autoload :Base, 'middleware_autocomplete/base'
|
5
|
+
autoload :Router, 'middleware_autocomplete/router'
|
6
|
+
autoload :UrlHelpers, 'middleware_autocomplete/url_helpers'
|
6
7
|
|
7
8
|
# Path namespace for autocompletes
|
8
9
|
mattr_accessor :namespace
|
9
|
-
@@namespace = '/
|
10
|
+
@@namespace = '/autocomplete'
|
10
11
|
|
11
12
|
# Default content_type
|
12
13
|
mattr_accessor :content_type
|
13
14
|
@@content_type = :json
|
14
15
|
|
16
|
+
# Wraps search requests with ActiveRecord::Base.connection_pool.with_connection
|
17
|
+
# It opens and closes connection to db when required
|
18
|
+
# If you are using AR to get search results keep it turned on
|
19
|
+
mattr_accessor :use_with_connection
|
20
|
+
@@use_with_connection = true
|
21
|
+
|
15
22
|
ROUTES = ActiveSupport::OrderedHash.new
|
23
|
+
|
24
|
+
def self.setup
|
25
|
+
yield self
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.load_routes
|
29
|
+
Base.descendants.each do |klass|
|
30
|
+
ROUTES[klass.route] = klass
|
31
|
+
end
|
32
|
+
|
33
|
+
UrlHelpers.generate_helpers!
|
34
|
+
Rails.application.routes.named_routes.module.send(:include, UrlHelpers)
|
35
|
+
end
|
16
36
|
end
|
@@ -3,58 +3,75 @@ module MiddlewareAutocomplete
|
|
3
3
|
class << self
|
4
4
|
attr_accessor :namespace, :path, :route_name, :content_type, :search_key
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
klass.route
|
18
|
-
end
|
19
|
-
end
|
6
|
+
# Calls user defined method to return results
|
7
|
+
# Wraps this method with AR with_connection to prevent connection leaks
|
8
|
+
#
|
9
|
+
# ==== Attributes
|
10
|
+
#
|
11
|
+
# * +params+ - Params hash passed to request
|
12
|
+
def perform(params)
|
13
|
+
if use_with_connection
|
14
|
+
with_connection { search(params) }
|
15
|
+
else
|
16
|
+
search(params)
|
20
17
|
end
|
21
18
|
end
|
22
19
|
|
20
|
+
# Full path to the Autocomplete class
|
23
21
|
def route
|
24
22
|
[namespace, path].join('/')
|
25
23
|
end
|
26
24
|
|
25
|
+
# Path without namespace
|
27
26
|
def path
|
28
27
|
@path || default_path
|
29
28
|
end
|
30
29
|
|
31
|
-
|
32
|
-
|
30
|
+
# Route name to access Autocomplete search, e.g. autocomplete_posts_path
|
31
|
+
def route_name
|
32
|
+
@route_name || default_route_name
|
33
33
|
end
|
34
34
|
|
35
35
|
def namespace
|
36
36
|
@namespace || MiddlewareAutocomplete.namespace
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
@
|
41
|
-
end
|
42
|
-
|
43
|
-
def default_route_name
|
44
|
-
"autocomplete_#{default_path}"
|
39
|
+
def use_with_connection
|
40
|
+
@use_with_connection || MiddlewareAutocomplete.use_with_connection
|
45
41
|
end
|
46
42
|
|
47
|
-
|
43
|
+
# Returns search results for autocompletition
|
44
|
+
# Result should be in the same format that your content_type
|
45
|
+
# Should be defined by user
|
46
|
+
def search(params)
|
48
47
|
raise NotImplementedError
|
49
48
|
end
|
50
49
|
|
50
|
+
# Content type symbol, e.g. :json, :xml
|
51
51
|
def content_type
|
52
52
|
@content_type || MiddlewareAutocomplete.content_type
|
53
53
|
end
|
54
54
|
|
55
|
+
# Content type string, e.g. 'application/json', 'application/xml'
|
55
56
|
def content_type_string
|
56
57
|
Mime::Type.lookup_by_extension(content_type).to_s
|
57
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def default_route_name
|
63
|
+
"autocomplete_#{default_path}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def default_path
|
67
|
+
name.demodulize.sub(/Autocomplete\Z/, '').underscore
|
68
|
+
end
|
69
|
+
|
70
|
+
def with_connection
|
71
|
+
ActiveRecord::Base.connection_pool.with_connection do
|
72
|
+
yield
|
73
|
+
end
|
74
|
+
end
|
58
75
|
end
|
59
76
|
end
|
60
77
|
end
|
@@ -5,7 +5,7 @@ module MiddlewareAutocomplete
|
|
5
5
|
Dir.glob(Rails.root + "app/autocompletes/**/*_autocomplete.rb").each do |c|
|
6
6
|
require_dependency(c)
|
7
7
|
end
|
8
|
-
MiddlewareAutocomplete
|
8
|
+
MiddlewareAutocomplete.load_routes
|
9
9
|
end
|
10
10
|
|
11
11
|
initializer 'middleware_autocomplete.connect_middleware_router' do |app|
|
@@ -5,16 +5,12 @@ module MiddlewareAutocomplete
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def call(env)
|
8
|
-
if (klass = ROUTES[env['
|
9
|
-
|
10
|
-
result = ActiveRecord::Base.connection_pool.with_connection do
|
11
|
-
klass.search(request.params)
|
12
|
-
end
|
8
|
+
if (klass = ROUTES[env['PATH_INFO']])
|
9
|
+
result = klass.perform(Rack::Request.new(env).params)
|
13
10
|
[200, { 'Content-Type' => klass.content_type_string }, [result]]
|
14
11
|
else
|
15
12
|
@app.call(env)
|
16
13
|
end
|
17
14
|
end
|
18
|
-
|
19
15
|
end
|
20
16
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MiddlewareAutocomplete
|
2
|
+
module UrlHelpers
|
3
|
+
def self.remove_helpers!
|
4
|
+
self.instance_methods.map(&:to_s).grep(/_(url|path)$/).each do |method|
|
5
|
+
remove_method method
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.generate_helpers!
|
10
|
+
# Add url helpers namespace_route_path
|
11
|
+
MiddlewareAutocomplete::ROUTES.each do |route_path, klass|
|
12
|
+
define_method "#{klass.route_name}_path" do
|
13
|
+
route_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class PostsAutocomplete < MiddlewareAutocomplete::Base
|
2
2
|
def self.search(params)
|
3
|
-
Post.where("title LIKE ?", "#{params['q']}_%")
|
3
|
+
Post.where("title LIKE ?", "#{params['q']}_%")
|
4
|
+
.order(:title).limit(10).pluck(:title).to_json
|
4
5
|
end
|
5
6
|
end
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
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: 20140414220337) do
|
15
|
+
|
16
|
+
create_table "posts", force: true do |t|
|
17
|
+
t.string "title"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
[1m[36m (127.6ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (59.6ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
+
Migrating to CreatePosts (20140414220337)
|
6
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "created_at" datetime, "updated_at" datetime)
|
8
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140414220337"]]
|
9
|
+
[1m[35m (70.7ms)[0m commit transaction
|
10
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
data/test/dummy/log/test.log
CHANGED
@@ -2,19 +2,474 @@
|
|
2
2
|
--------------------------------------
|
3
3
|
MiddlewareAutocompleteTest: test_truth
|
4
4
|
--------------------------------------
|
5
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
6
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7
|
+
---------------------------------------------------------
|
8
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
9
|
+
---------------------------------------------------------
|
10
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:16:32 +0300
|
11
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
12
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
13
|
+
---------------------------------------------
|
14
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
15
|
+
---------------------------------------------
|
16
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
17
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
18
|
+
--------------------------------------
|
19
|
+
MiddlewareAutocompleteTest: test_truth
|
20
|
+
--------------------------------------
|
21
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
22
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
23
|
+
---------------------------------------------------------
|
24
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
25
|
+
---------------------------------------------------------
|
26
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:17:42 +0300
|
27
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
28
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
29
|
+
---------------------------------------------
|
30
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
31
|
+
---------------------------------------------
|
32
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
33
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
34
|
+
--------------------------------------
|
35
|
+
MiddlewareAutocompleteTest: test_truth
|
36
|
+
--------------------------------------
|
37
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
38
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
39
|
+
---------------------------------------------------------
|
40
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
41
|
+
---------------------------------------------------------
|
42
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:18:22 +0300
|
43
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
44
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
45
|
+
---------------------------------------------
|
46
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
47
|
+
---------------------------------------------
|
48
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
49
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
50
|
+
--------------------------------------
|
51
|
+
MiddlewareAutocompleteTest: test_truth
|
52
|
+
--------------------------------------
|
53
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
54
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
55
|
+
---------------------------------------------------------
|
56
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
57
|
+
---------------------------------------------------------
|
58
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:21:44 +0300
|
59
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
60
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
61
|
+
---------------------------------------------
|
62
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
63
|
+
---------------------------------------------
|
64
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
65
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
66
|
+
--------------------------------------
|
67
|
+
MiddlewareAutocompleteTest: test_truth
|
68
|
+
--------------------------------------
|
69
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
70
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
71
|
+
---------------------------------------------------------
|
72
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
73
|
+
---------------------------------------------------------
|
74
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:26:35 +0300
|
75
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
76
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
77
|
+
---------------------------------------------
|
78
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
79
|
+
---------------------------------------------
|
80
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
81
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
82
|
+
--------------------------------------
|
83
|
+
MiddlewareAutocompleteTest: test_truth
|
84
|
+
--------------------------------------
|
85
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
86
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
87
|
+
---------------------------------------------------------
|
88
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
89
|
+
---------------------------------------------------------
|
90
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:26:38 +0300
|
91
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
92
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
93
|
+
---------------------------------------------
|
94
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
95
|
+
---------------------------------------------
|
96
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
97
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
98
|
+
--------------------------------------
|
99
|
+
MiddlewareAutocompleteTest: test_truth
|
100
|
+
--------------------------------------
|
101
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
102
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
103
|
+
---------------------------------------------------------
|
104
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
105
|
+
---------------------------------------------------------
|
106
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:27:23 +0300
|
107
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
108
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
109
|
+
---------------------------------------------
|
110
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
111
|
+
---------------------------------------------
|
112
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
113
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
114
|
+
--------------------------------------
|
115
|
+
MiddlewareAutocompleteTest: test_truth
|
116
|
+
--------------------------------------
|
117
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
118
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
119
|
+
---------------------------------------------------------
|
120
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
121
|
+
---------------------------------------------------------
|
122
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:29:38 +0300
|
123
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
124
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
125
|
+
---------------------------------------------
|
126
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
127
|
+
---------------------------------------------
|
128
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
129
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
130
|
+
--------------------------------------
|
131
|
+
MiddlewareAutocompleteTest: test_truth
|
132
|
+
--------------------------------------
|
133
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
134
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
135
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
136
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
137
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
138
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
139
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
140
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
141
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
142
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
143
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
144
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
145
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
146
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
5
147
|
[1m[35m (0.0ms)[0m rollback transaction
|
148
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
149
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
6
150
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
151
|
+
---------------------------------------------------------
|
152
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
153
|
+
---------------------------------------------------------
|
154
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 01:35:51 +0300
|
155
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
156
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
157
|
+
---------------------------------------------
|
158
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
159
|
+
---------------------------------------------
|
160
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
161
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
7
162
|
--------------------------------------
|
8
163
|
MiddlewareAutocompleteTest: test_truth
|
9
164
|
--------------------------------------
|
10
165
|
[1m[35m (0.0ms)[0m rollback transaction
|
11
166
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
167
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
168
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
169
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
170
|
+
[1m[36m (122.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
171
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
172
|
+
[1m[36m (59.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
173
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
174
|
+
Migrating to CreatePosts (20140414220337)
|
175
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
176
|
+
[1m[35m (0.5ms)[0m CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "created_at" datetime, "updated_at" datetime)
|
177
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140414220337"]]
|
178
|
+
[1m[35m (73.5ms)[0m commit transaction
|
179
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
180
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
181
|
+
[1m[35m (0.1ms)[0m begin transaction
|
182
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
183
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-14 22:38:03', '2014-04-14 22:38:03', 980190962)
|
184
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-14 22:38:03', '2014-04-14 22:38:03', 298486374)[0m
|
185
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-14 22:38:03', '2014-04-14 22:38:03', 113629430)
|
186
|
+
[1m[36m (97.5ms)[0m [1mcommit transaction[0m
|
187
|
+
[1m[35m (0.1ms)[0m begin transaction
|
188
|
+
---------------------------------------------
|
189
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
190
|
+
---------------------------------------------
|
191
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
192
|
+
[1m[35m (0.1ms)[0m begin transaction
|
193
|
+
--------------------------------------
|
194
|
+
MiddlewareAutocompleteTest: test_truth
|
195
|
+
--------------------------------------
|
196
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
197
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
198
|
+
[1m[35m (0.1ms)[0m begin transaction
|
199
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "posts"[0m
|
200
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-14 22:40:17', '2014-04-14 22:40:17', 980190962)
|
201
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-14 22:40:17', '2014-04-14 22:40:17', 298486374)[0m
|
202
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-14 22:40:17', '2014-04-14 22:40:17', 113629430)
|
203
|
+
[1m[36m (91.4ms)[0m [1mcommit transaction[0m
|
204
|
+
[1m[35m (0.1ms)[0m begin transaction
|
205
|
+
---------------------------------------------
|
206
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
207
|
+
---------------------------------------------
|
208
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
209
|
+
[1m[35m (0.1ms)[0m begin transaction
|
210
|
+
--------------------------------------
|
211
|
+
MiddlewareAutocompleteTest: test_truth
|
212
|
+
--------------------------------------
|
213
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
214
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
215
|
+
[1m[35m (0.1ms)[0m begin transaction
|
216
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "posts"[0m
|
217
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-14 22:40:37', '2014-04-14 22:40:37', 980190962)
|
218
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-14 22:40:37', '2014-04-14 22:40:37', 298486374)[0m
|
219
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-14 22:40:37', '2014-04-14 22:40:37', 113629430)
|
220
|
+
[1m[36m (126.1ms)[0m [1mcommit transaction[0m
|
221
|
+
[1m[35m (0.1ms)[0m begin transaction
|
222
|
+
--------------------------------------
|
223
|
+
MiddlewareAutocompleteTest: test_truth
|
224
|
+
--------------------------------------
|
225
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
226
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
227
|
+
[1m[35m (0.1ms)[0m begin transaction
|
228
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
229
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-14 22:43:58', '2014-04-14 22:43:58', 980190962)
|
230
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-14 22:43:58', '2014-04-14 22:43:58', 298486374)[0m
|
231
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-14 22:43:58', '2014-04-14 22:43:58', 113629430)
|
232
|
+
[1m[36m (132.1ms)[0m [1mcommit transaction[0m
|
233
|
+
[1m[35m (0.1ms)[0m begin transaction
|
234
|
+
--------------------------------------
|
235
|
+
MiddlewareAutocompleteTest: test_truth
|
236
|
+
--------------------------------------
|
237
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
238
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
239
|
+
[1m[35m (0.1ms)[0m begin transaction
|
240
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
241
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-14 22:44:35', '2014-04-14 22:44:35', 980190962)
|
242
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-14 22:44:35', '2014-04-14 22:44:35', 298486374)[0m
|
243
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-14 22:44:35', '2014-04-14 22:44:35', 113629430)
|
244
|
+
[1m[36m (131.8ms)[0m [1mcommit transaction[0m
|
245
|
+
[1m[35m (0.2ms)[0m begin transaction
|
246
|
+
--------------------------------------
|
247
|
+
MiddlewareAutocompleteTest: test_truth
|
248
|
+
--------------------------------------
|
249
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
250
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
251
|
+
[1m[35m (0.1ms)[0m begin transaction
|
252
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
253
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:17:23', '2014-04-15 06:17:23', 980190962)
|
254
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:17:23', '2014-04-15 06:17:23', 298486374)[0m
|
255
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:17:23', '2014-04-15 06:17:23', 113629430)
|
256
|
+
[1m[36m (78.8ms)[0m [1mcommit transaction[0m
|
257
|
+
[1m[35m (0.1ms)[0m begin transaction
|
258
|
+
--------------------------------------
|
259
|
+
MiddlewareAutocompleteTest: test_truth
|
260
|
+
--------------------------------------
|
261
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
262
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
263
|
+
[1m[35m (0.1ms)[0m begin transaction
|
264
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
265
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:17:34', '2014-04-15 06:17:34', 980190962)
|
266
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:17:34', '2014-04-15 06:17:34', 298486374)[0m
|
267
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:17:34', '2014-04-15 06:17:34', 113629430)
|
268
|
+
[1m[36m (114.0ms)[0m [1mcommit transaction[0m
|
269
|
+
[1m[35m (0.1ms)[0m begin transaction
|
270
|
+
---------------------------------------------------------
|
271
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
272
|
+
---------------------------------------------------------
|
273
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:17:34 +0300
|
274
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') LIMIT 10[0m
|
275
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
276
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
277
|
+
--------------------------------------
|
278
|
+
MiddlewareAutocompleteTest: test_truth
|
279
|
+
--------------------------------------
|
280
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
281
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
282
|
+
[1m[35m (0.1ms)[0m begin transaction
|
283
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
284
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:19:18', '2014-04-15 06:19:18', 980190962)
|
285
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:19:18', '2014-04-15 06:19:18', 298486374)[0m
|
286
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:19:18', '2014-04-15 06:19:18', 113629430)
|
287
|
+
[1m[36m (114.3ms)[0m [1mcommit transaction[0m
|
288
|
+
[1m[35m (0.1ms)[0m begin transaction
|
289
|
+
---------------------------------------------------------
|
290
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
291
|
+
---------------------------------------------------------
|
292
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:19:18 +0300
|
293
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') LIMIT 10[0m
|
294
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
295
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
12
296
|
--------------------------------------
|
13
297
|
MiddlewareAutocompleteTest: test_truth
|
14
298
|
--------------------------------------
|
15
299
|
[1m[35m (0.0ms)[0m rollback transaction
|
300
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
301
|
+
[1m[35m (0.1ms)[0m begin transaction
|
302
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
303
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:20:12', '2014-04-15 06:20:12', 980190962)
|
304
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:20:12', '2014-04-15 06:20:12', 298486374)[0m
|
305
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:20:12', '2014-04-15 06:20:12', 113629430)
|
306
|
+
[1m[36m (109.4ms)[0m [1mcommit transaction[0m
|
307
|
+
[1m[35m (0.1ms)[0m begin transaction
|
308
|
+
---------------------------------------------------------
|
309
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
310
|
+
---------------------------------------------------------
|
311
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:20:12 +0300
|
312
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') LIMIT 10[0m
|
313
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
314
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
315
|
+
--------------------------------------
|
316
|
+
MiddlewareAutocompleteTest: test_truth
|
317
|
+
--------------------------------------
|
318
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
319
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
320
|
+
[1m[35m (0.1ms)[0m begin transaction
|
321
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "posts"[0m
|
322
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:21:26', '2014-04-15 06:21:26', 980190962)
|
323
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:21:26', '2014-04-15 06:21:26', 298486374)[0m
|
324
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:21:26', '2014-04-15 06:21:26', 113629430)
|
325
|
+
[1m[36m (76.3ms)[0m [1mcommit transaction[0m
|
326
|
+
[1m[35m (0.1ms)[0m begin transaction
|
327
|
+
---------------------------------------------------------
|
328
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
329
|
+
---------------------------------------------------------
|
330
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:21:26 +0300
|
331
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
332
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
333
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
334
|
+
--------------------------------------
|
335
|
+
MiddlewareAutocompleteTest: test_truth
|
336
|
+
--------------------------------------
|
337
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
338
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
339
|
+
[1m[35m (0.1ms)[0m begin transaction
|
340
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
341
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:21:55', '2014-04-15 06:21:55', 980190962)
|
342
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:21:55', '2014-04-15 06:21:55', 298486374)[0m
|
343
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:21:55', '2014-04-15 06:21:55', 113629430)
|
344
|
+
[1m[36m (81.3ms)[0m [1mcommit transaction[0m
|
345
|
+
[1m[35m (0.1ms)[0m begin transaction
|
346
|
+
---------------------------------------------------------
|
347
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
348
|
+
---------------------------------------------------------
|
349
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:21:55 +0300
|
350
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
351
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
16
352
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
17
353
|
--------------------------------------
|
18
354
|
MiddlewareAutocompleteTest: test_truth
|
19
355
|
--------------------------------------
|
20
356
|
[1m[35m (0.0ms)[0m rollback transaction
|
357
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
358
|
+
[1m[35m (0.1ms)[0m begin transaction
|
359
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
360
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:22:45', '2014-04-15 06:22:45', 980190962)
|
361
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:22:45', '2014-04-15 06:22:45', 298486374)[0m
|
362
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:22:45', '2014-04-15 06:22:45', 113629430)
|
363
|
+
[1m[36m (110.5ms)[0m [1mcommit transaction[0m
|
364
|
+
[1m[35m (0.1ms)[0m begin transaction
|
365
|
+
------------------------------------------
|
366
|
+
NavigationTest: test_passes_request_params
|
367
|
+
------------------------------------------
|
368
|
+
Started GET "/autocomplete/posts?q=Another" for 127.0.0.1 at 2014-04-15 09:22:45 +0300
|
369
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE 'Another_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
370
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
371
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
372
|
+
---------------------------------------------------------
|
373
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
374
|
+
---------------------------------------------------------
|
375
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:22:45 +0300
|
376
|
+
[1m[35m (0.2ms)[0m SELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10
|
377
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
378
|
+
[1m[35m (0.1ms)[0m begin transaction
|
379
|
+
--------------------------------------
|
380
|
+
MiddlewareAutocompleteTest: test_truth
|
381
|
+
--------------------------------------
|
382
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
383
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
384
|
+
[1m[35m (0.1ms)[0m begin transaction
|
385
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "posts"[0m
|
386
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:24:24', '2014-04-15 06:24:24', 980190962)
|
387
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:24:24', '2014-04-15 06:24:24', 298486374)[0m
|
388
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:24:24', '2014-04-15 06:24:24', 113629430)
|
389
|
+
[1m[36m (115.5ms)[0m [1mcommit transaction[0m
|
390
|
+
[1m[35m (0.1ms)[0m begin transaction
|
391
|
+
------------------------------------------
|
392
|
+
NavigationTest: test_passes_request_params
|
393
|
+
------------------------------------------
|
394
|
+
Started GET "/autocomplete/posts?q=Another" for 127.0.0.1 at 2014-04-15 09:24:24 +0300
|
395
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE 'Another_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
396
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
397
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
398
|
+
---------------------------------------------------------
|
399
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
400
|
+
---------------------------------------------------------
|
401
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:24:24 +0300
|
402
|
+
[1m[35m (0.1ms)[0m SELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10
|
403
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
404
|
+
[1m[35m (0.0ms)[0m begin transaction
|
405
|
+
---------------------------------------------
|
406
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
407
|
+
---------------------------------------------
|
408
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
409
|
+
[1m[35m (0.1ms)[0m begin transaction
|
410
|
+
--------------------------------------
|
411
|
+
MiddlewareAutocompleteTest: test_truth
|
412
|
+
--------------------------------------
|
413
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
414
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
415
|
+
[1m[35m (0.1ms)[0m begin transaction
|
416
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "posts"[0m
|
417
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:24:36', '2014-04-15 06:24:36', 980190962)
|
418
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:24:36', '2014-04-15 06:24:36', 298486374)[0m
|
419
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:24:36', '2014-04-15 06:24:36', 113629430)
|
420
|
+
[1m[36m (75.1ms)[0m [1mcommit transaction[0m
|
421
|
+
[1m[35m (0.1ms)[0m begin transaction
|
422
|
+
------------------------------------------
|
423
|
+
NavigationTest: test_passes_request_params
|
424
|
+
------------------------------------------
|
425
|
+
Started GET "/autocomplete/posts?q=Another" for 127.0.0.1 at 2014-04-15 09:24:36 +0300
|
426
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE 'Another_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
427
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
428
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
429
|
+
---------------------------------------------------------
|
430
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
431
|
+
---------------------------------------------------------
|
432
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:24:36 +0300
|
433
|
+
[1m[35m (0.2ms)[0m SELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10
|
434
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
435
|
+
[1m[35m (0.1ms)[0m begin transaction
|
436
|
+
---------------------------------------------
|
437
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
438
|
+
---------------------------------------------
|
439
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
440
|
+
[1m[35m (0.0ms)[0m begin transaction
|
441
|
+
--------------------------------------
|
442
|
+
MiddlewareAutocompleteTest: test_truth
|
443
|
+
--------------------------------------
|
444
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
445
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
446
|
+
[1m[35m (0.1ms)[0m begin transaction
|
447
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "posts"[0m
|
448
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Title', '2014-04-15 06:44:46', '2014-04-15 06:44:46', 980190962)
|
449
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Second Title', '2014-04-15 06:44:46', '2014-04-15 06:44:46', 298486374)[0m
|
450
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "posts" ("title", "created_at", "updated_at", "id") VALUES ('Another One Title', '2014-04-15 06:44:46', '2014-04-15 06:44:46', 113629430)
|
451
|
+
[1m[36m (77.2ms)[0m [1mcommit transaction[0m
|
452
|
+
[1m[35m (0.1ms)[0m begin transaction
|
453
|
+
------------------------------------------
|
454
|
+
NavigationTest: test_passes_request_params
|
455
|
+
------------------------------------------
|
456
|
+
Started GET "/autocomplete/posts?q=Another" for 127.0.0.1 at 2014-04-15 09:44:47 +0300
|
457
|
+
[1m[36m (0.2ms)[0m [1mSELECT "posts"."title" FROM "posts" WHERE (title LIKE 'Another_%') ORDER BY "posts"."title" ASC LIMIT 10[0m
|
458
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
459
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
460
|
+
---------------------------------------------------------
|
461
|
+
NavigationTest: test_returns_json_from_autocomplete_route
|
462
|
+
---------------------------------------------------------
|
463
|
+
Started GET "/autocomplete/posts" for 127.0.0.1 at 2014-04-15 09:44:47 +0300
|
464
|
+
[1m[35m (0.1ms)[0m SELECT "posts"."title" FROM "posts" WHERE (title LIKE '_%') ORDER BY "posts"."title" ASC LIMIT 10
|
465
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
466
|
+
[1m[35m (0.0ms)[0m begin transaction
|
467
|
+
---------------------------------------------
|
468
|
+
MiddlewareAutocompleteTest: test_loads_routes
|
469
|
+
---------------------------------------------
|
470
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
471
|
+
[1m[35m (0.0ms)[0m begin transaction
|
472
|
+
--------------------------------------
|
473
|
+
MiddlewareAutocompleteTest: test_truth
|
474
|
+
--------------------------------------
|
475
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
@@ -1,10 +1,22 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class NavigationTest < ActionDispatch::IntegrationTest
|
4
|
-
|
4
|
+
def json_response
|
5
|
+
ActiveSupport::JSON.decode @response.body
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
test "returns json from autocomplete route" do
|
9
|
+
get autocomplete_posts_path
|
10
|
+
|
11
|
+
assert_response :success
|
12
|
+
assert_equal ['Another One Title', 'Second Title', 'Title'], json_response
|
13
|
+
end
|
14
|
+
|
15
|
+
test "passes request params" do
|
16
|
+
get autocomplete_posts_path, q: 'Another'
|
17
|
+
|
18
|
+
assert_response :success
|
19
|
+
assert_equal ['Another One Title'], json_response
|
20
|
+
end
|
9
21
|
end
|
10
22
|
|
data/test/test_helper.rb
CHANGED
@@ -12,7 +12,13 @@ Rails.backtrace_cleaner.remove_silencers!
|
|
12
12
|
# Load support files
|
13
13
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
14
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
15
|
+
# if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
16
|
+
# ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
17
|
+
# end
|
18
|
+
|
19
|
+
# # Load fixtures from the engine
|
20
|
+
# ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
21
|
+
|
22
|
+
class ActiveSupport::TestCase
|
23
|
+
fixtures :all
|
18
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleware_autocomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Ilchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/middleware_autocomplete/base.rb
|
93
93
|
- lib/middleware_autocomplete/engine.rb
|
94
94
|
- lib/middleware_autocomplete/router.rb
|
95
|
+
- lib/middleware_autocomplete/url_helpers.rb
|
95
96
|
- lib/middleware_autocomplete/version.rb
|
96
97
|
- test/dummy/README.rdoc
|
97
98
|
- test/dummy/Rakefile
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- test/dummy/app/autocompletes/posts_autocomplete.rb
|
101
102
|
- test/dummy/app/controllers/application_controller.rb
|
102
103
|
- test/dummy/app/helpers/application_helper.rb
|
104
|
+
- test/dummy/app/models/post.rb
|
103
105
|
- test/dummy/app/views/layouts/application.html.erb
|
104
106
|
- test/dummy/bin/bundle
|
105
107
|
- test/dummy/bin/rails
|
@@ -122,6 +124,9 @@ files:
|
|
122
124
|
- test/dummy/config/locales/en.yml
|
123
125
|
- test/dummy/config/routes.rb
|
124
126
|
- test/dummy/config/secrets.yml
|
127
|
+
- test/dummy/db/development.sqlite3
|
128
|
+
- test/dummy/db/migrate/20140414220337_create_posts.rb
|
129
|
+
- test/dummy/db/schema.rb
|
125
130
|
- test/dummy/db/test.sqlite3
|
126
131
|
- test/dummy/log/development.log
|
127
132
|
- test/dummy/log/test.log
|
@@ -129,6 +134,7 @@ files:
|
|
129
134
|
- test/dummy/public/422.html
|
130
135
|
- test/dummy/public/500.html
|
131
136
|
- test/dummy/public/favicon.ico
|
137
|
+
- test/dummy/test/fixtures/posts.yml
|
132
138
|
- test/integration/navigation_test.rb
|
133
139
|
- test/middleware_autocomplete_test.rb
|
134
140
|
- test/test_helper.rb
|
@@ -158,41 +164,46 @@ specification_version: 4
|
|
158
164
|
summary: Fast autocomplete for Rails.
|
159
165
|
test_files:
|
160
166
|
- test/middleware_autocomplete_test.rb
|
161
|
-
- test/
|
167
|
+
- test/test_helper.rb
|
168
|
+
- test/dummy/db/development.sqlite3
|
169
|
+
- test/dummy/db/test.sqlite3
|
170
|
+
- test/dummy/db/migrate/20140414220337_create_posts.rb
|
171
|
+
- test/dummy/db/schema.rb
|
172
|
+
- test/dummy/README.rdoc
|
162
173
|
- test/dummy/config.ru
|
163
|
-
- test/dummy/log/development.log
|
164
|
-
- test/dummy/log/test.log
|
165
|
-
- test/dummy/bin/bundle
|
166
|
-
- test/dummy/bin/rails
|
167
|
-
- test/dummy/bin/rake
|
168
|
-
- test/dummy/app/autocompletes/posts_autocomplete.rb
|
169
|
-
- test/dummy/app/controllers/application_controller.rb
|
170
|
-
- test/dummy/app/views/layouts/application.html.erb
|
171
|
-
- test/dummy/app/helpers/application_helper.rb
|
172
|
-
- test/dummy/app/assets/stylesheets/application.css
|
173
|
-
- test/dummy/app/assets/javascripts/application.js
|
174
174
|
- test/dummy/public/favicon.ico
|
175
|
-
- test/dummy/public/500.html
|
176
175
|
- test/dummy/public/422.html
|
177
176
|
- test/dummy/public/404.html
|
178
|
-
- test/dummy/
|
179
|
-
- test/dummy/
|
180
|
-
- test/dummy/
|
181
|
-
- test/dummy/
|
177
|
+
- test/dummy/public/500.html
|
178
|
+
- test/dummy/bin/rails
|
179
|
+
- test/dummy/bin/bundle
|
180
|
+
- test/dummy/bin/rake
|
181
|
+
- test/dummy/config/boot.rb
|
182
182
|
- test/dummy/config/environment.rb
|
183
|
-
- test/dummy/config/routes.rb
|
184
183
|
- test/dummy/config/secrets.yml
|
185
184
|
- test/dummy/config/application.rb
|
186
|
-
- test/dummy/config/
|
187
|
-
- test/dummy/config/
|
185
|
+
- test/dummy/config/environments/test.rb
|
186
|
+
- test/dummy/config/environments/production.rb
|
187
|
+
- test/dummy/config/environments/development.rb
|
188
|
+
- test/dummy/config/routes.rb
|
189
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
190
|
+
- test/dummy/config/initializers/session_store.rb
|
188
191
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
189
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
190
192
|
- test/dummy/config/initializers/mime_types.rb
|
191
|
-
- test/dummy/config/initializers/
|
193
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
194
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
192
195
|
- test/dummy/config/initializers/inflections.rb
|
193
|
-
- test/dummy/config/initializers/session_store.rb
|
194
|
-
- test/dummy/config/boot.rb
|
195
196
|
- test/dummy/config/database.yml
|
196
|
-
- test/dummy/
|
197
|
-
- test/
|
197
|
+
- test/dummy/config/locales/en.yml
|
198
|
+
- test/dummy/Rakefile
|
199
|
+
- test/dummy/app/helpers/application_helper.rb
|
200
|
+
- test/dummy/app/views/layouts/application.html.erb
|
201
|
+
- test/dummy/app/models/post.rb
|
202
|
+
- test/dummy/app/controllers/application_controller.rb
|
203
|
+
- test/dummy/app/autocompletes/posts_autocomplete.rb
|
204
|
+
- test/dummy/app/assets/javascripts/application.js
|
205
|
+
- test/dummy/app/assets/stylesheets/application.css
|
206
|
+
- test/dummy/test/fixtures/posts.yml
|
207
|
+
- test/dummy/log/development.log
|
208
|
+
- test/dummy/log/test.log
|
198
209
|
- test/integration/navigation_test.rb
|