openstax_utilities 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NjczMjZiNWYzMjljMzM4ZjMyM2FlYjg2MGMxNzhlZDUxODNiOWY1MQ==
5
- data.tar.gz: !binary |-
6
- ZDMzZDg3N2E2MzRmZjYzNDIxYjA5YjNiOTNmYjBkODllNjM1ODE0ZA==
2
+ SHA1:
3
+ metadata.gz: 5f74a54eb979770038bb0b7a22dd9ab49c7d0bd7
4
+ data.tar.gz: 24be3a1eba292de415db675f55c93fcb127bf693
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NzA2YTc4MGI1ZDhjZmU0ZWVlMzc3YzAzMDBlMGZjMzZjODE4NDNjZGNlNzRj
10
- YTNkYzU0NDA2YTgzOWUxNTkxZWEzYjZmODAxNDRkOTc0MDZjNzVlMGMwYzYy
11
- ZGY0NzQxMGI2ZTJkNWNhMzI3ZGRhOWYwYjRkZDdkNTYzMGQwMWI=
12
- data.tar.gz: !binary |-
13
- MzZiN2YyYzBmMTRhOTMzNDFkNTA2MWZiY2JlZDFmZWVmNGJhZGJiN2YwYmM3
14
- OGUzYThkOGIxMTQ1ZmY1MDljNTQ5NTZlNTVjNWVlZmQ4N2ZlNGUyM2E0NDg4
15
- NGQxMDM1ZWMyNzYwNmFiNWY4MTE1M2VmYjI4YjVkZjM3NGE3NDA=
6
+ metadata.gz: 3cd0d23114ea4b34234afab28e67ee749af4150a50510fc85c12ec740a10a45518be29405ca8a350ee713eda378850e205394207d3d09ee74ae4c68ab6fac132
7
+ data.tar.gz: 77855c34ee526501c39e723164036aa2af493cb473fb4f7c68b481795844641ca6170ed8da1f39a5c6b5a15cdd99bd42ebce9b5d7f379823330f2209bc6598e8
@@ -5,12 +5,12 @@
5
5
  # Values are comma-separated, while keywords are space-separated
6
6
  # See https://github.com/bruce/keyword_search for more information
7
7
  #
8
- # Subclasses must set the search_routine class variable,
9
- # as well as the authorized? method
8
+ # Callers must pass the search_routine and search_relation options:
10
9
  #
11
10
  # Required:
12
11
  #
13
- # search_routine - the Lev::Routine that will handle the search
12
+ # search_routine - the Lev::Routine that will handle the search
13
+ # search_relation - the ActiveRecord::Relation that will be searched
14
14
  #
15
15
  # Optional (recommended to prevent scraping):
16
16
  #
@@ -19,13 +19,13 @@
19
19
  # than the minimum number of characters allowed
20
20
  # default: nil (disabled)
21
21
  #
22
- # max_items - the maximum number of matching items allowed to be returned
23
- # no results will be returned if this number is exceeded,
24
- # but the total result count will still be returned
25
- # applies even if pagination is enabled
26
- # default: nil (disabled)
22
+ # max_items - the maximum number of matching items allowed to be returned
23
+ # no results will be returned if this number is exceeded,
24
+ # but the total result count will still be returned
25
+ # applies even if pagination is enabled
26
+ # default: nil (disabled)
27
27
  #
28
- # This handler expects the following parameters from the user or the UI:
28
+ # This handler also expects the following parameters from the user or the UI:
29
29
  #
30
30
  # Required:
31
31
  #
@@ -50,35 +50,38 @@ require 'lev'
50
50
 
51
51
  module OpenStax
52
52
  module Utilities
53
- class AbstractKeywordSearchHandler
53
+ class KeywordSearchHandler
54
54
 
55
55
  lev_handler
56
56
 
57
57
  protected
58
58
 
59
- class_attribute :search_routine, :max_items, :min_characters
60
-
61
59
  def authorized?
62
- false
60
+ routine = options[:search_routine]
61
+ relation = options[:search_relation]
62
+ raise ArgumentError if routine.nil? || relation.nil?
63
+ OSU::AccessPolicy.action_allowed?(:search, caller, relation.base_class)
63
64
  end
64
65
 
65
66
  def handle
66
- raise NotImplementedError if search_routine.nil?
67
-
68
- query = params[:q] || params[:query]
69
-
70
- fatal_error(code: :no_query,
67
+ query = params[:q]
68
+ fatal_error(code: :query_blank,
71
69
  message: 'You must provide a query parameter (q or query).') if query.nil?
70
+
71
+ min_characters = options[:min_characters]
72
72
  fatal_error(code: :query_too_short,
73
73
  message: "The provided query is too short (minimum #{
74
74
  min_characters} characters).") \
75
75
  if !min_characters.nil? && query.length < min_characters
76
76
 
77
- items = run(search_routine, query, params).outputs[:items]
77
+ routine = options[:search_routine]
78
+ relation = options[:search_relation]
79
+ items = run(routine, relation, query, params).outputs[:items]
78
80
 
79
81
  outputs[:total_count] = items.limit(nil).offset(nil).count
80
82
 
81
- fatal_error(code: :too_many_matches,
83
+ max_items = options[:max_items]
84
+ fatal_error(code: :too_many_items,
82
85
  message: "The number of matches exceeded the allowed limit of #{
83
86
  max_items} matches. Please refine your query and try again.") \
84
87
  if !max_items.nil? && outputs[:total_count] > max_items
@@ -5,17 +5,14 @@
5
5
  # Values are comma-separated, while keywords are space-separated
6
6
  # See https://github.com/bruce/keyword_search for more information
7
7
  #
8
- # Subclasses must set the initial_relation, search_proc and sortable_fields class variables
9
- #
10
- # initial_relation - the ActiveRecord::Relation that contains all
11
- # records to be searched, usually ClassName.unscoped
8
+ # Subclasses must set the search_proc and sortable_fields class variables
12
9
  #
13
10
  # search_proc - a proc passed to keyword_search's `search` method
14
11
  # it receives keyword_search's `with` object as argument
15
12
  # this proc must define the `keyword` blocks for keyword_search
16
13
  # the relation to be scoped is contained in the @items instance variable
17
- #
18
- # The `to_string_array` helper can help with parsing strings from the query
14
+ # the `to_string_array` helper can help with
15
+ # parsing strings from the query
19
16
  #
20
17
  # sortable_fields_map - a Hash that maps the lowercase names of fields
21
18
  # which can be used to sort the results to symbols
@@ -24,11 +21,16 @@
24
21
  # in options[:order_by]
25
22
  # values are the corresponding database column names
26
23
  # that will be passed to the order() method
24
+ # columns from other tables can be specified either
25
+ # through Arel attributes (Class.arel_table[:column])
26
+ # or through literal strings
27
27
  #
28
- # Callers of subclass routines provides a query argument and an options hash
28
+ # Callers of subclass routines provide a relation argument,
29
+ # a query argument and an options hash
29
30
  #
30
31
  # Required arguments:
31
32
  #
33
+ # relation - the initial relation to start searching on
32
34
  # query - a string that follows the keyword format above
33
35
  #
34
36
  # Options hash:
@@ -37,7 +39,7 @@
37
39
  #
38
40
  # :order_by - list of fields to sort by, with optional sort directions
39
41
  # can be a String, Array of Strings or Array of Hashes
40
- # default: {"created_at" => :asc}
42
+ # default: {:created_at => :asc}
41
43
  #
42
44
  # Pagination:
43
45
  #
@@ -66,15 +68,15 @@ module OpenStax
66
68
 
67
69
  protected
68
70
 
69
- class_attribute :initial_relation, :search_proc, :sortable_fields_map
71
+ class_attribute :search_proc, :sortable_fields_map
70
72
 
71
- def exec(query, options = {})
72
- raise NotImplementedError if initial_relation.nil? || \
73
- search_proc.nil? || sortable_fields_map.nil?
73
+ def exec(relation, query, options = {})
74
+ raise NotImplementedError if search_proc.nil? || sortable_fields_map.nil?
74
75
 
75
- @items = initial_relation
76
+ raise ArgumentError \
77
+ unless relation.is_a?(ActiveRecord::Relation) && query.is_a?(String)
76
78
 
77
- return @items.none unless query.is_a? String
79
+ @items = relation
78
80
 
79
81
  # Scoping
80
82
 
@@ -101,7 +103,14 @@ module OpenStax
101
103
  def sanitize_order_by(field, dir = nil)
102
104
  sanitized_field = sortable_fields_map[field.to_s.downcase] || :created_at
103
105
  sanitized_dir = dir.to_s.downcase == 'desc' ? :desc : :asc
104
- {sanitized_field => sanitized_dir}
106
+ case sanitized_field
107
+ when Symbol
108
+ {sanitized_field => sanitized_dir}
109
+ when Arel::Attributes::Attribute
110
+ sanitized_field.send sanitized_dir
111
+ else
112
+ "#{sanitized_field.to_s} #{sanitized_dir.to_s.upcase}"
113
+ end
105
114
  end
106
115
 
107
116
  def sanitize_order_bys(order_bys)
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Utilities
3
- VERSION = "4.0.0"
3
+ VERSION = "4.1.0"
4
4
  end
5
5
  end
@@ -7,4 +7,4 @@ class DummyAccessPolicy
7
7
  @@last_resource = resource
8
8
  true
9
9
  end
10
- end
10
+ end
@@ -1,7 +1,6 @@
1
1
  # Dummy routine for testing the general keyword search
2
2
 
3
3
  class SearchUsers < OpenStax::Utilities::AbstractKeywordSearchRoutine
4
- self.initial_relation = User.unscoped
5
4
  self.search_proc = lambda { |with|
6
5
  with.keyword :username do |names|
7
6
  snames = to_string_array(names, append_wildcard: true)
@@ -0,0 +1 @@
1
+ OSU::AccessPolicy.register(User, DummyAccessPolicy)
@@ -2,9 +2,15 @@ require 'rails_helper'
2
2
 
3
3
  module OpenStax
4
4
  module Utilities
5
- describe AbstractKeywordSearchHandler do
5
+ describe KeywordSearchHandler do
6
6
 
7
- let!(:users_search) { UsersSearch.new }
7
+ options = {
8
+ caller: FactoryGirl.create(:user),
9
+ search_routine: SearchUsers,
10
+ search_relation: User.unscoped,
11
+ max_items: 10,
12
+ min_characters: 3
13
+ }
8
14
 
9
15
  let!(:john_doe) { FactoryGirl.create :user, name: "John Doe",
10
16
  username: "doejohn",
@@ -22,12 +28,20 @@ module OpenStax
22
28
  100.times do
23
29
  FactoryGirl.create(:user)
24
30
  end
31
+
32
+ DummyAccessPolicy.last_action = nil
33
+ DummyAccessPolicy.last_requestor = nil
34
+ DummyAccessPolicy.last_resource = nil
25
35
  end
26
36
 
27
37
  it "passes its params to the search routine and sets the total_count output" do
28
- outputs = users_search.call(params: {q: 'username:dOe'}).outputs
38
+ outputs = KeywordSearchHandler.call(options.merge(
39
+ params: {q: 'username:dOe'})).outputs
29
40
  total_count = outputs[:total_count]
30
41
  items = outputs[:items]
42
+ expect(DummyAccessPolicy.last_action).to eq :search
43
+ expect(DummyAccessPolicy.last_requestor).to eq options[:caller]
44
+ expect(DummyAccessPolicy.last_resource).to eq User
31
45
  expect(total_count).to eq items.count
32
46
  expect(items).to include(john_doe)
33
47
  expect(items).to include(jane_doe)
@@ -41,10 +55,17 @@ module OpenStax
41
55
  expect(item.username).to match(/\Adoe[\w]*\z/i)
42
56
  end
43
57
 
44
- outputs = users_search.call(params: {order_by: 'cReAtEd_At DeSc, iD dEsC',
45
- q: 'username:DoE'}).outputs
58
+ DummyAccessPolicy.last_action = nil
59
+ DummyAccessPolicy.last_requestor = nil
60
+ DummyAccessPolicy.last_resource = nil
61
+ outputs = KeywordSearchHandler.call(options.merge(
62
+ params: {order_by: 'cReAtEd_At DeSc, iD dEsC',
63
+ q: 'username:DoE'})).outputs
46
64
  total_count = outputs[:total_count]
47
65
  items = outputs[:items]
66
+ expect(DummyAccessPolicy.last_action).to eq :search
67
+ expect(DummyAccessPolicy.last_requestor).to eq options[:caller]
68
+ expect(DummyAccessPolicy.last_resource).to eq User
48
69
  expect(total_count).to eq items.count
49
70
  expect(items).to include(john_doe)
50
71
  expect(items).to include(jane_doe)
@@ -60,32 +81,44 @@ module OpenStax
60
81
  end
61
82
 
62
83
  it "errors out if no query is provided" do
63
- routine = users_search.call(params: {})
84
+ routine = KeywordSearchHandler.call(options.merge(params: {}))
64
85
  outputs = routine.outputs
65
86
  errors = routine.errors
87
+ expect(DummyAccessPolicy.last_action).to eq :search
88
+ expect(DummyAccessPolicy.last_requestor).to eq options[:caller]
89
+ expect(DummyAccessPolicy.last_resource).to eq User
66
90
  expect(outputs).to be_empty
67
91
  expect(errors).not_to be_empty
68
- expect(errors.first.code).to eq :no_query
92
+ expect(errors.first.code).to eq :query_blank
69
93
  end
70
94
 
71
95
  it "errors out if the query is too short" do
72
- routine = users_search.call(params: {q: 'a'})
96
+ routine = KeywordSearchHandler.call(options.merge(params: {q: 'a'}))
73
97
  outputs = routine.outputs
74
98
  errors = routine.errors
99
+ expect(DummyAccessPolicy.last_action).to eq :search
100
+ expect(DummyAccessPolicy.last_requestor).to eq options[:caller]
101
+ expect(DummyAccessPolicy.last_resource).to eq User
75
102
  expect(outputs).to be_empty
76
103
  expect(errors).not_to be_empty
77
104
  expect(errors.first.code).to eq :query_too_short
78
105
  end
79
106
 
80
107
  it "errors out if too many items match" do
81
- routine = users_search.call(params: {q: 'username:a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,-,_'})
108
+ routine = KeywordSearchHandler.call(options.merge(
109
+ params: {
110
+ q: 'username:a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,-,_'
111
+ }))
82
112
  outputs = routine.outputs
83
113
  errors = routine.errors
114
+ expect(DummyAccessPolicy.last_action).to eq :search
115
+ expect(DummyAccessPolicy.last_requestor).to eq options[:caller]
116
+ expect(DummyAccessPolicy.last_resource).to eq User
84
117
  expect(outputs).not_to be_empty
85
118
  expect(outputs[:total_count]).to eq User.count
86
119
  expect(outputs[:items]).to be_nil
87
120
  expect(errors).not_to be_empty
88
- expect(errors.first.code).to eq :too_many_matches
121
+ expect(errors.first.code).to eq :too_many_items
89
122
  end
90
123
 
91
124
  end
@@ -23,7 +23,7 @@ module OpenStax
23
23
  end
24
24
 
25
25
  it "filters results based on one field" do
26
- items = SearchUsers.call('last_name:dOe').outputs[:items]
26
+ items = SearchUsers.call(User.unscoped, 'last_name:dOe').outputs[:items]
27
27
 
28
28
  expect(items).to include(john_doe)
29
29
  expect(items).to include(jane_doe)
@@ -34,7 +34,8 @@ module OpenStax
34
34
  end
35
35
 
36
36
  it "filters results based on multiple fields" do
37
- items = SearchUsers.call('first_name:jOhN last_name:DoE').outputs[:items]
37
+ items = SearchUsers.call(User.unscoped, 'first_name:jOhN last_name:DoE')
38
+ .outputs[:items]
38
39
 
39
40
  expect(items).to include(john_doe)
40
41
  expect(items).not_to include(jane_doe)
@@ -45,7 +46,8 @@ module OpenStax
45
46
  end
46
47
 
47
48
  it "filters results based on multiple keywords per field" do
48
- items = SearchUsers.call('first_name:JoHn,JaNe last_name:dOe').outputs[:items]
49
+ items = SearchUsers.call(User.unscoped, 'first_name:JoHn,JaNe last_name:dOe')
50
+ .outputs[:items]
49
51
 
50
52
  expect(items).to include(john_doe)
51
53
  expect(items).to include(jane_doe)
@@ -55,8 +57,21 @@ module OpenStax
55
57
  end
56
58
  end
57
59
 
60
+ it "filters scoped results" do
61
+ items = SearchUsers.call(User.where{name.like 'jOhN%'},
62
+ 'last_name:dOe').outputs[:items]
63
+
64
+ expect(items).to include(john_doe)
65
+ expect(items).not_to include(jane_doe)
66
+ expect(items).not_to include(jack_doe)
67
+ items.each do |item|
68
+ expect(item.name.downcase).to match(/\Ajohn[\w]* doe[\w]*\z/i)
69
+ end
70
+ end
71
+
58
72
  it "orders results by multiple fields in different directions" do
59
- items = SearchUsers.call('username:DoE', order_by: 'cReAtEd_At AsC, iD')
73
+ items = SearchUsers.call(User.unscoped, 'username:DoE',
74
+ order_by: 'cReAtEd_At AsC, iD')
60
75
  .outputs[:items]
61
76
  expect(items).to include(john_doe)
62
77
  expect(items).to include(jane_doe)
@@ -70,7 +85,8 @@ module OpenStax
70
85
  expect(item.username).to match(/\Adoe[\w]*\z/i)
71
86
  end
72
87
 
73
- items = SearchUsers.call('username:dOe', order_by: 'CrEaTeD_aT dEsC, Id DeSc')
88
+ items = SearchUsers.call(User.unscoped, 'username:dOe',
89
+ order_by: 'CrEaTeD_aT dEsC, Id DeSc')
74
90
  .outputs[:items]
75
91
  expect(items).to include(john_doe)
76
92
  expect(items).to include(jane_doe)
@@ -86,23 +102,25 @@ module OpenStax
86
102
  end
87
103
 
88
104
  it "paginates results" do
89
- all_items = SearchUsers.call('').outputs[:items].to_a
105
+ all_items = SearchUsers.call(User.unscoped, '').outputs[:items].to_a
90
106
 
91
- items = SearchUsers.call('', per_page: 20).outputs[:items]
107
+ items = SearchUsers.call(User.unscoped, '', per_page: 20).outputs[:items]
92
108
  expect(items.limit(nil).offset(nil).count).to eq all_items.count
93
109
  expect(items.limit(nil).offset(nil).to_a).to eq all_items
94
110
  expect(items.count).to eq 20
95
111
  expect(items.to_a).to eq all_items[0..19]
96
112
 
97
113
  for page in 1..5
98
- items = SearchUsers.call('', page: page, per_page: 20).outputs[:items]
114
+ items = SearchUsers.call(User.unscoped, '', page: page, per_page: 20)
115
+ .outputs[:items]
99
116
  expect(items.limit(nil).offset(nil).count).to eq all_items.count
100
117
  expect(items.limit(nil).offset(nil).to_a).to eq all_items
101
118
  expect(items.count).to eq 20
102
119
  expect(items.to_a).to eq all_items.slice(20*(page-1), 20)
103
120
  end
104
121
 
105
- items = SearchUsers.call('', page: 1000, per_page: 20).outputs[:items]
122
+ items = SearchUsers.call(User.unscoped, '', page: 1000, per_page: 20)
123
+ .outputs[:items]
106
124
  expect(items.limit(nil).offset(nil).count).to eq all_items.count
107
125
  expect(items.limit(nil).offset(nil).to_a).to eq all_items
108
126
  expect(items.count).to eq 0
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-07 00:00:00.000000000 Z
11
+ date: 2014-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: lev
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: keyword_search
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: factory_girl_rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: faker
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: squeel
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Shared utilities for OpenStax web sites
@@ -132,7 +132,7 @@ files:
132
132
  - MIT-LICENSE
133
133
  - README.md
134
134
  - Rakefile
135
- - app/handlers/openstax/utilities/abstract_keyword_search_handler.rb
135
+ - app/handlers/openstax/utilities/keyword_search_handler.rb
136
136
  - app/routines/openstax/utilities/abstract_keyword_search_routine.rb
137
137
  - app/views/osu/shared/_action_list.html.erb
138
138
  - lib/openstax/utilities/access.rb
@@ -162,7 +162,6 @@ files:
162
162
  - spec/dummy/app/assets/javascripts/application.js
163
163
  - spec/dummy/app/assets/stylesheets/application.css
164
164
  - spec/dummy/app/controllers/application_controller.rb
165
- - spec/dummy/app/handlers/users_search.rb
166
165
  - spec/dummy/app/helpers/application_helper.rb
167
166
  - spec/dummy/app/models/user.rb
168
167
  - spec/dummy/app/routines/search_users.rb
@@ -178,6 +177,7 @@ files:
178
177
  - spec/dummy/config/environments/development.rb
179
178
  - spec/dummy/config/environments/production.rb
180
179
  - spec/dummy/config/environments/test.rb
180
+ - spec/dummy/config/initializers/access_policies.rb
181
181
  - spec/dummy/config/initializers/assets.rb
182
182
  - spec/dummy/config/initializers/backtrace_silencers.rb
183
183
  - spec/dummy/config/initializers/cookies_serializer.rb
@@ -196,7 +196,7 @@ files:
196
196
  - spec/dummy/public/500.html
197
197
  - spec/dummy/public/favicon.ico
198
198
  - spec/factories/user.rb
199
- - spec/handlers/openstax/utilities/abstract_keyword_search_handler_spec.rb
199
+ - spec/handlers/openstax/utilities/keyword_search_handler_spec.rb
200
200
  - spec/lib/openstax/utilities/access_policy_spec.rb
201
201
  - spec/rails_helper.rb
202
202
  - spec/routines/openstax/utilities/abstract_keyword_search_routine_spec.rb
@@ -211,17 +211,17 @@ require_paths:
211
211
  - lib
212
212
  required_ruby_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - ! '>='
214
+ - - ">="
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  requirements:
219
- - - ! '>='
219
+ - - ">="
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.2.1
224
+ rubygems_version: 2.2.2
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Utilities for OpenStax web sites
@@ -230,7 +230,6 @@ test_files:
230
230
  - spec/dummy/app/assets/javascripts/application.js
231
231
  - spec/dummy/app/assets/stylesheets/application.css
232
232
  - spec/dummy/app/controllers/application_controller.rb
233
- - spec/dummy/app/handlers/users_search.rb
234
233
  - spec/dummy/app/helpers/application_helper.rb
235
234
  - spec/dummy/app/models/user.rb
236
235
  - spec/dummy/app/routines/search_users.rb
@@ -245,6 +244,7 @@ test_files:
245
244
  - spec/dummy/config/environments/development.rb
246
245
  - spec/dummy/config/environments/production.rb
247
246
  - spec/dummy/config/environments/test.rb
247
+ - spec/dummy/config/initializers/access_policies.rb
248
248
  - spec/dummy/config/initializers/assets.rb
249
249
  - spec/dummy/config/initializers/backtrace_silencers.rb
250
250
  - spec/dummy/config/initializers/cookies_serializer.rb
@@ -266,7 +266,7 @@ test_files:
266
266
  - spec/dummy/Rakefile
267
267
  - spec/dummy/README.md
268
268
  - spec/factories/user.rb
269
- - spec/handlers/openstax/utilities/abstract_keyword_search_handler_spec.rb
269
+ - spec/handlers/openstax/utilities/keyword_search_handler_spec.rb
270
270
  - spec/lib/openstax/utilities/access_policy_spec.rb
271
271
  - spec/rails_helper.rb
272
272
  - spec/routines/openstax/utilities/abstract_keyword_search_routine_spec.rb
@@ -1,11 +0,0 @@
1
- # Dummy handler for testing the general keyword search
2
-
3
- class UsersSearch < OpenStax::Utilities::AbstractKeywordSearchHandler
4
- self.search_routine = SearchUsers
5
- self.max_items = 10
6
- self.min_characters = 3
7
-
8
- def authorized?
9
- true
10
- end
11
- end