cloud_search 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/cloud_search/version.rb
CHANGED
@@ -142,54 +142,74 @@ describe CloudSearch::Document do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
context "lang validation" do
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
context "when type is 'add'" do
|
146
|
+
it "is invalid if lang is nil" do
|
147
|
+
document = described_class.new :lang => nil, :type => "add"
|
148
|
+
document.valid?
|
149
|
+
expect(document.errors[:lang]).to eql(["can't be blank"])
|
150
|
+
end
|
150
151
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
152
|
+
it "is invalid if lang contains digits" do
|
153
|
+
document = described_class.new :lang => "a1", :type => "add"
|
154
|
+
document.valid?
|
155
|
+
expect(document.errors[:lang]).to eql(["is invalid"])
|
156
|
+
end
|
156
157
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
158
|
+
it "is invalid if lang contains more than 2 characters" do
|
159
|
+
document = described_class.new :lang => "abc", :type => "add"
|
160
|
+
document.valid?
|
161
|
+
expect(document.errors[:lang]).to eql(["is invalid"])
|
162
|
+
end
|
162
163
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
it "is invalid if lang contains upper case characters" do
|
165
|
+
document = described_class.new :lang => "Ab", :type => "add"
|
166
|
+
document.valid?
|
167
|
+
expect(document.errors[:lang]).to eql(["is invalid"])
|
168
|
+
end
|
169
|
+
|
170
|
+
it "is valid if lang contains 2 lower case characters" do
|
171
|
+
document = described_class.new :lang => "en", :type => "add"
|
172
|
+
document.valid?
|
173
|
+
expect(document.errors[:lang]).to be_nil
|
174
|
+
end
|
167
175
|
end
|
168
176
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
177
|
+
context "when type is 'delete'" do
|
178
|
+
it "is optional" do
|
179
|
+
document = described_class.new :type => "delete"
|
180
|
+
document.valid?
|
181
|
+
expect(document.errors[:lang]).to be_nil
|
182
|
+
end
|
173
183
|
end
|
174
184
|
end
|
175
185
|
|
176
186
|
context "fields validation" do
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
187
|
+
context "when type is 'add'" do
|
188
|
+
it "is invalid if fields is nil" do
|
189
|
+
document = described_class.new :fields => nil, :type => "add"
|
190
|
+
document.valid?
|
191
|
+
expect(document.errors[:fields]).to eql(["can't be empty"])
|
192
|
+
end
|
182
193
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
194
|
+
it "is invalid if fields is not a hash" do
|
195
|
+
document = described_class.new :fields => [], :type => "add"
|
196
|
+
document.valid?
|
197
|
+
expect(document.errors[:fields]).to eql(["must be an instance of Hash"])
|
198
|
+
end
|
199
|
+
|
200
|
+
it "is valid with a Hash" do
|
201
|
+
document = described_class.new :fields => {}, :type => "add"
|
202
|
+
document.valid?
|
203
|
+
expect(document.errors[:fields]).to be_nil
|
204
|
+
end
|
187
205
|
end
|
188
206
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
207
|
+
context "when type is 'delete'" do
|
208
|
+
it "is optional" do
|
209
|
+
document = described_class.new :type => "delete"
|
210
|
+
document.valid?
|
211
|
+
expect(document.errors[:fields]).to be_nil
|
212
|
+
end
|
193
213
|
end
|
194
214
|
end
|
195
215
|
|
@@ -4,6 +4,6 @@ describe CloudSearch::InvalidDocument do
|
|
4
4
|
let(:document) { CloudSearch::Document.new }
|
5
5
|
|
6
6
|
it "has a message with the document errors" do
|
7
|
-
expect(described_class.new(document).message).to eq("id: can't be blank; version: can't be blank; type: can't be blank
|
7
|
+
expect(described_class.new(document).message).to eq("id: can't be blank; version: can't be blank; type: can't be blank")
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -175,18 +175,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
- - ! '>='
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
hash: 4455518161793254465
|
181
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
179
|
none: false
|
183
180
|
requirements:
|
184
181
|
- - ! '>='
|
185
182
|
- !ruby/object:Gem::Version
|
186
183
|
version: '0'
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
hash: 4455518161793254465
|
190
184
|
requirements: []
|
191
185
|
rubyforge_project:
|
192
186
|
rubygems_version: 1.8.24
|
@@ -210,3 +204,4 @@ test_files:
|
|
210
204
|
- spec/fixtures/vcr_cassettes/search/request/paginated_second_page.yml
|
211
205
|
- spec/spec_helper.rb
|
212
206
|
- spec/support/vcr.rb
|
207
|
+
has_rdoc:
|