openstax_api 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,14 +7,15 @@ module OpenStax
7
7
  let!(:controller) { OpenStax::Api::V1::ApiController.new }
8
8
 
9
9
  it 'adds methods to ApiController instance' do
10
+ expect(controller).to respond_to(:standard_search)
10
11
  expect(controller).to respond_to(:standard_create)
11
12
  expect(controller).to respond_to(:standard_read)
12
13
  expect(controller).to respond_to(:standard_update)
13
14
  expect(controller).to respond_to(:standard_destroy)
14
- expect(controller).to respond_to(:standard_nested_create)
15
15
  expect(controller).to respond_to(:standard_index)
16
- expect(controller).to respond_to(:standard_search)
17
16
  expect(controller).to respond_to(:standard_sort)
17
+ expect(controller).to respond_to(:standard_nested_create)
18
+ expect(controller).to respond_to(:render_api_errors)
18
19
  end
19
20
  end
20
21
  end
@@ -12,9 +12,8 @@ module OpenStax
12
12
  end
13
13
  end
14
14
  route_names = Rails.application.routes.named_routes.names
15
+ expect(route_names).to include(:api)
15
16
  expect(route_names).to include(:api_dummy_models)
16
- expect(route_names).to include(:new_api_dummy_models)
17
- expect(route_names).to include(:edit_api_dummy_models)
18
17
  end
19
18
  end
20
19
  end
@@ -28,7 +28,7 @@ module OpenStax
28
28
  end
29
29
 
30
30
  it "represents search results" do
31
- outputs = SearchUsers.call('last_name:dOe').outputs
31
+ outputs = SearchUsers.call(User.unscoped, 'last_name:dOe').outputs
32
32
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
33
33
  total_count = response['total_count']
34
34
  items = response['items']
@@ -38,7 +38,8 @@ module OpenStax
38
38
  expect(items).to include(@jane_hash)
39
39
  expect(items).to include(@jack_hash)
40
40
 
41
- outputs = SearchUsers.call('first_name:jOhN last_name:DoE').outputs
41
+ outputs = SearchUsers.call(User.unscoped,
42
+ 'first_name:jOhN last_name:DoE').outputs
42
43
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
43
44
  total_count = response['total_count']
44
45
  items = response['items']
@@ -48,7 +49,8 @@ module OpenStax
48
49
  expect(items).not_to include(@jane_hash)
49
50
  expect(items).not_to include(@jack_hash)
50
51
 
51
- outputs = SearchUsers.call('first_name:JoHn,JaNe last_name:dOe').outputs
52
+ outputs = SearchUsers.call(User.unscoped,
53
+ 'first_name:JoHn,JaNe last_name:dOe').outputs
52
54
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
53
55
  total_count = response['total_count']
54
56
  items = response['items']
@@ -60,7 +62,8 @@ module OpenStax
60
62
  end
61
63
 
62
64
  it "represents ordered results" do
63
- outputs = SearchUsers.call('username:DoE', order_by: 'cReAtEd_At AsC, iD')
65
+ outputs = SearchUsers.call(User.unscoped, 'username:DoE',
66
+ order_by: 'cReAtEd_At AsC, iD')
64
67
  .outputs
65
68
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
66
69
  total_count = response['total_count']
@@ -71,7 +74,8 @@ module OpenStax
71
74
  expect(items[1]).to eq @jane_hash
72
75
  expect(items[2]).to eq @jack_hash
73
76
 
74
- outputs = SearchUsers.call('username:dOe', order_by: 'CrEaTeD_aT dEsC, Id DeSc')
77
+ outputs = SearchUsers.call(User.unscoped, 'username:dOe',
78
+ order_by: 'CrEaTeD_aT dEsC, Id DeSc')
75
79
  .outputs
76
80
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
77
81
  total_count = response['total_count']
@@ -86,7 +90,7 @@ module OpenStax
86
90
  it "represents paginated results" do
87
91
  user_count = User.count
88
92
 
89
- outputs = SearchUsers.call('').outputs
93
+ outputs = SearchUsers.call(User.unscoped, '').outputs
90
94
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
91
95
  total_count = response['total_count']
92
96
  items = response['items']
@@ -94,7 +98,7 @@ module OpenStax
94
98
  expect(total_count).to eq user_count
95
99
  expect(items.count).to eq user_count
96
100
 
97
- outputs = SearchUsers.call('', per_page: 20).outputs
101
+ outputs = SearchUsers.call(User.unscoped, '', per_page: 20).outputs
98
102
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
99
103
  total_count = response['total_count']
100
104
  items = response['items']
@@ -103,7 +107,8 @@ module OpenStax
103
107
  expect(items.count).to eq 20
104
108
 
105
109
  for page in 1..5
106
- outputs = SearchUsers.call('', page: page, per_page: 20).outputs
110
+ outputs = SearchUsers.call(User.unscoped, '',
111
+ page: page, per_page: 20).outputs
107
112
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
108
113
  total_count = response['total_count']
109
114
  items = response['items']
@@ -112,7 +117,8 @@ module OpenStax
112
117
  expect(items.count).to eq 20
113
118
  end
114
119
 
115
- outputs = SearchUsers.call('', page: 1000, per_page: 20).outputs
120
+ outputs = SearchUsers.call(User.unscoped, '',
121
+ page: 1000, per_page: 20).outputs
116
122
  response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
117
123
  total_count = response['total_count']
118
124
  items = response['items']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-08 00:00:00.000000000 Z
12
+ date: 2014-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -101,14 +101,28 @@ dependencies:
101
101
  requirements:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 4.0.0
104
+ version: 4.1.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 4.0.0
111
+ version: 4.1.0
112
+ - !ruby/object:Gem::Dependency
113
+ name: lev
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.0.0
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 1.0.0
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: sqlite3
114
128
  requirement: !ruby/object:Gem::Requirement