sinatra_resource 0.4.17 → 0.4.18

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ begin
14
14
  gem.add_dependency 'mongo_mapper', '>= 0.7'
15
15
  gem.add_dependency 'mongo', '>= 0.18.3'
16
16
  gem.add_dependency 'mongo_ext', '>= 0.18.3'
17
- gem.add_dependency 'sinatra', '>= 0.9.4', '< 1.0'
17
+ gem.add_dependency 'sinatra', '>= 1.0'
18
18
  gem.add_dependency 'query_string_filter', '>= 0.1.4'
19
19
 
20
20
  gem.add_development_dependency 'crack', '>= 0.1.4'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.17
1
+ 0.4.18
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'sinatra', '>= 0.9.4'
3
+ gem 'sinatra', '>= 1.0'
4
4
  require 'sinatra/base'
5
5
 
6
6
  require File.dirname(__FILE__) + '/config/config'
@@ -10,7 +10,7 @@ gem 'mongo', "= 0.18.3", '< 1.0'
10
10
  gem 'mongo_ext', "= 0.18.3", '< 1.0'
11
11
  require 'mongo'
12
12
 
13
- gem 'mongo_mapper', '>= 0.7', '< 0.8'
13
+ gem 'mongo_mapper', '= 0.7.0'
14
14
  require 'mongo_mapper'
15
15
 
16
16
  module Config
@@ -121,4 +121,49 @@ class SourcesGetManySearchResourceTest < ResourceTestCase
121
121
  end
122
122
  end
123
123
 
124
+ context "search=flight delays" do
125
+ before do
126
+ @search_params = { :search => "flight delays" }
127
+ end
128
+
129
+ %w(basic).each do |role|
130
+ context "#{role} : get /" do
131
+ before do
132
+ get "/", @search_params.merge(:api_key => api_key_for(role))
133
+ @members = parsed_response_body['members']
134
+ end
135
+
136
+ use "return 200 Ok"
137
+
138
+ test "body should have correct sources" do
139
+ titles = @members.map { |x| x['title'] }
140
+ assert_equal 1, titles.length
141
+ assert_include %{Airline On-Time Performance and Causes of Flight Delays}, titles
142
+ end
143
+ end
144
+ end
145
+ end
146
+
147
+ context "search=" do
148
+ before do
149
+ @search_params = { :search => "" }
150
+ end
151
+
152
+ %w(basic).each do |role|
153
+ context "#{role} : get /" do
154
+ before do
155
+ get "/", @search_params.merge(:api_key => api_key_for(role))
156
+ @members = parsed_response_body['members']
157
+ end
158
+
159
+ use "return 200 Ok"
160
+
161
+ test "body should have no sources" do
162
+ titles = @members.map { |x| x['title'] }
163
+ assert_equal 0, titles.length
164
+ end
165
+ end
166
+ end
167
+ end
168
+
124
169
  end
@@ -369,7 +369,8 @@ module SinatraResource
369
369
  if search_string && filter_string
370
370
  error 400, convert(body_for(:invalid_params, [FILTER_KEY]))
371
371
  elsif search_string
372
- { :_keywords => search_string.downcase }
372
+ words = search_string.downcase.split(" ")
373
+ { :_keywords => { '$all' => words } }
373
374
  elsif filter_string
374
375
  begin
375
376
  unsafe = QS_FILTER.parse(filter_string)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_resource}
8
- s.version = "0.4.17"
8
+ s.version = "0.4.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David James"]
12
- s.date = %q{2010-03-08}
12
+ s.date = %q{2010-04-05}
13
13
  s.description = %q{A DSL for creating RESTful actions with Sinatra and MongoMapper. It embraces the Resource Oriented Architecture as explained by Leonard Richardson and Sam Ruby.}
14
14
  s.email = %q{djames@sunlightfoundation.com}
15
15
  s.extra_rdoc_files = [
@@ -208,7 +208,7 @@ Gem::Specification.new do |s|
208
208
  s.add_runtime_dependency(%q<mongo_mapper>, [">= 0.7"])
209
209
  s.add_runtime_dependency(%q<mongo>, [">= 0.18.3"])
210
210
  s.add_runtime_dependency(%q<mongo_ext>, [">= 0.18.3"])
211
- s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4", "< 1.0"])
211
+ s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
212
212
  s.add_runtime_dependency(%q<query_string_filter>, [">= 0.1.4"])
213
213
  s.add_development_dependency(%q<crack>, [">= 0.1.4"])
214
214
  s.add_development_dependency(%q<djsun-context>, [">= 0.5.6"])
@@ -219,7 +219,7 @@ Gem::Specification.new do |s|
219
219
  s.add_dependency(%q<mongo_mapper>, [">= 0.7"])
220
220
  s.add_dependency(%q<mongo>, [">= 0.18.3"])
221
221
  s.add_dependency(%q<mongo_ext>, [">= 0.18.3"])
222
- s.add_dependency(%q<sinatra>, [">= 0.9.4", "< 1.0"])
222
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
223
223
  s.add_dependency(%q<query_string_filter>, [">= 0.1.4"])
224
224
  s.add_dependency(%q<crack>, [">= 0.1.4"])
225
225
  s.add_dependency(%q<djsun-context>, [">= 0.5.6"])
@@ -231,7 +231,7 @@ Gem::Specification.new do |s|
231
231
  s.add_dependency(%q<mongo_mapper>, [">= 0.7"])
232
232
  s.add_dependency(%q<mongo>, [">= 0.18.3"])
233
233
  s.add_dependency(%q<mongo_ext>, [">= 0.18.3"])
234
- s.add_dependency(%q<sinatra>, [">= 0.9.4", "< 1.0"])
234
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
235
235
  s.add_dependency(%q<query_string_filter>, [">= 0.1.4"])
236
236
  s.add_dependency(%q<crack>, [">= 0.1.4"])
237
237
  s.add_dependency(%q<djsun-context>, [">= 0.5.6"])
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rubygems'
3
4
  require 'sinatra_resource'
4
5
  require 'spec'
5
6
  require 'spec/autorun'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 17
9
- version: 0.4.17
8
+ - 18
9
+ version: 0.4.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - David James
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-08 00:00:00 -05:00
17
+ date: 2010-04-05 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,13 +64,6 @@ dependencies:
64
64
  requirement: &id004 !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
- - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
- - 9
71
- - 4
72
- version: 0.9.4
73
- - - <
74
67
  - !ruby/object:Gem::Version
75
68
  segments:
76
69
  - 1