flying-sphinx 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/flying_sphinx/index_request.rb +4 -3
- data/spec/flying_sphinx/index_request_spec.rb +8 -4
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
@@ -69,14 +69,15 @@ class FlyingSphinx::IndexRequest
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def request_complete?
|
72
|
-
|
72
|
+
response = api.get("/app/indices/#{index_id}")
|
73
|
+
case response.body
|
73
74
|
when 'FINISHED', 'FAILED'
|
74
|
-
puts "Indexing request failed." if response == 'FAILED'
|
75
|
+
puts "Indexing request failed." if response.body == 'FAILED'
|
75
76
|
true
|
76
77
|
when 'PENDING'
|
77
78
|
false
|
78
79
|
else
|
79
|
-
raise "Unknown index response: #{response}"
|
80
|
+
raise "Unknown index response: '#{response.body}'"
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
@@ -49,7 +49,8 @@ describe FlyingSphinx::IndexRequest do
|
|
49
49
|
api.should_receive(:put).with('/app', conf_params).and_return('ok')
|
50
50
|
api.should_receive(:post).
|
51
51
|
with('/app/indices', index_params).and_return(42)
|
52
|
-
api.should_receive(:get).with('/app/indices/42').
|
52
|
+
api.should_receive(:get).with('/app/indices/42').
|
53
|
+
and_return(stub(:response, :body => 'PENDING'))
|
53
54
|
|
54
55
|
begin
|
55
56
|
Timeout::timeout(0.2) {
|
@@ -63,7 +64,8 @@ describe FlyingSphinx::IndexRequest do
|
|
63
64
|
api.should_receive(:put).with('/app', conf_params).and_return('ok')
|
64
65
|
api.should_receive(:post).
|
65
66
|
with('/app/indices', index_params).and_return(42)
|
66
|
-
api.should_receive(:get).with('/app/indices/42').
|
67
|
+
api.should_receive(:get).with('/app/indices/42').
|
68
|
+
and_return(stub(:response, :body => 'FINISHED'))
|
67
69
|
|
68
70
|
index_request.update_and_index
|
69
71
|
end
|
@@ -87,7 +89,8 @@ describe FlyingSphinx::IndexRequest do
|
|
87
89
|
it "makes a new request" do
|
88
90
|
api.should_receive(:post).
|
89
91
|
with('/app/indices', index_params).and_return(42)
|
90
|
-
api.should_receive(:get).with('/app/indices/42').
|
92
|
+
api.should_receive(:get).with('/app/indices/42').
|
93
|
+
and_return(stub(:response, :body => 'PENDING'))
|
91
94
|
|
92
95
|
begin
|
93
96
|
Timeout::timeout(0.2) {
|
@@ -100,7 +103,8 @@ describe FlyingSphinx::IndexRequest do
|
|
100
103
|
it "should finish when the index request has been completed" do
|
101
104
|
api.should_receive(:post).
|
102
105
|
with('/app/indices', index_params).and_return(42)
|
103
|
-
api.should_receive(:get).with('/app/indices/42').
|
106
|
+
api.should_receive(:get).with('/app/indices/42').
|
107
|
+
and_return(stub(:response, :body => 'FINISHED'))
|
104
108
|
|
105
109
|
index_request.perform
|
106
110
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flying-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Allan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-24 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|