introspective_grape 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +13 -37
- data/CHANGELOG.md +7 -0
- data/gemfiles/2.2.0-Gemfile +1 -1
- data/gemfiles/Gemfile.rails.4.2.10 +12 -0
- data/gemfiles/Gemfile.rails.4.2.7.1 +1 -0
- data/gemfiles/Gemfile.rails.4.2.7.1.new.swagger +1 -0
- data/gemfiles/Gemfile.rails.4.2.8 +2 -0
- data/gemfiles/Gemfile.rails.5.0.0 +13 -0
- data/gemfiles/Gemfile.rails.5.0.1 +1 -1
- data/gemfiles/Gemfile.rails.5.1.0 +13 -0
- data/gemfiles/Gemfile.rails.5.2.0 +13 -0
- data/gemfiles/Gemfile.rails.6.0.0.beta1 +13 -0
- data/gemfiles/Gemfile.rails.master +1 -1
- data/introspective_grape.gemspec +11 -11
- data/lib/introspective_grape/api.rb +28 -29
- data/lib/introspective_grape/camel_snake.rb +30 -31
- data/lib/introspective_grape/create_helpers.rb +2 -2
- data/lib/introspective_grape/version.rb +1 -1
- data/spec/dummy/Gemfile +6 -4
- data/spec/dummy/app/models/role.rb +1 -1
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +3 -3
- data/spec/dummy/config/initializers/paperclip_adapter.rb +1 -1
- data/spec/requests/chat_api_spec.rb +26 -26
- data/spec/requests/company_api_spec.rb +15 -15
- data/spec/requests/location_api_spec.rb +18 -18
- data/spec/requests/project_api_spec.rb +20 -20
- data/spec/requests/role_api_spec.rb +4 -4
- data/spec/requests/sessions_api_spec.rb +10 -10
- data/spec/requests/swagger_spec.rb +1 -1
- data/spec/requests/user_api_spec.rb +34 -36
- metadata +29 -30
@@ -24,15 +24,15 @@ describe Dummy::ProjectAPI, type: :request do
|
|
24
24
|
|
25
25
|
context "As a super admin" do
|
26
26
|
it "should return a list of all projects" do
|
27
|
-
get '/api/v1/projects', per_page: 10, offset: 0
|
28
|
-
response.should
|
27
|
+
get '/api/v1/projects', params: { per_page: 10, offset: 0 }
|
28
|
+
response.should be_successful
|
29
29
|
json.length.should == Project.count
|
30
30
|
json.map{|c| c['id'].to_i}.include?(project.id).should == true
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should return the specified project" do
|
34
34
|
get "/api/v1/projects/#{project.id}"
|
35
|
-
response.should
|
35
|
+
response.should be_successful
|
36
36
|
json['name'].should == project.name
|
37
37
|
end
|
38
38
|
|
@@ -56,8 +56,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
56
56
|
p = {
|
57
57
|
name: 'New Team', team_users_attributes: [{ user_id: @u1.id }, { user_id: @u2.id }]
|
58
58
|
}
|
59
|
-
post "/api/v1/projects/#{project.id}/teams", p
|
60
|
-
response.should
|
59
|
+
post "/api/v1/projects/#{project.id}/teams", params: p
|
60
|
+
response.should be_successful
|
61
61
|
Team.last.name.should == 'New Team'
|
62
62
|
Team.last.users.to_a.should == [@u1,@u2]
|
63
63
|
end
|
@@ -66,8 +66,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
66
66
|
p = { team_users_attributes: [
|
67
67
|
{ user_id: @u1.id }, { user_id: @u2.id }
|
68
68
|
] }
|
69
|
-
put "/api/v1/projects/#{project.id}/teams/#{@team.id}", p
|
70
|
-
response.should
|
69
|
+
put "/api/v1/projects/#{project.id}/teams/#{@team.id}", params: p
|
70
|
+
response.should be_successful
|
71
71
|
|
72
72
|
Team.last.users.to_a.should == [@u1,@u2]
|
73
73
|
end
|
@@ -78,8 +78,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
78
78
|
p = { team_users_attributes: [
|
79
79
|
{ id: @team.team_users.where(user_id:@u1.id).first.id, _destroy: 1 }
|
80
80
|
] }
|
81
|
-
put "/api/v1/projects/#{project.id}/teams/#{@team.id}", p
|
82
|
-
response.should
|
81
|
+
put "/api/v1/projects/#{project.id}/teams/#{@team.id}", params: p
|
82
|
+
response.should be_successful
|
83
83
|
Team.last.users.to_a.should == [@u2]
|
84
84
|
end
|
85
85
|
end
|
@@ -87,8 +87,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
87
87
|
context "edit a project team via nested routes" do
|
88
88
|
it "should add a team member" do
|
89
89
|
p = { user_id: @u1.id }
|
90
|
-
post "/api/v1/projects/#{project.id}/teams/#{@team.id}/team_users", p
|
91
|
-
response.should
|
90
|
+
post "/api/v1/projects/#{project.id}/teams/#{@team.id}/team_users", params: p
|
91
|
+
response.should be_successful
|
92
92
|
Team.last.users.to_a.should == [@u1]
|
93
93
|
end
|
94
94
|
|
@@ -97,7 +97,7 @@ describe Dummy::ProjectAPI, type: :request do
|
|
97
97
|
@team.save!
|
98
98
|
id = @team.team_users.where(user_id:@u1.id).first.id
|
99
99
|
delete "/api/v1/projects/#{project.id}/teams/#{@team.id}/team_users/#{id}"
|
100
|
-
response.should
|
100
|
+
response.should be_successful
|
101
101
|
Team.last.users.to_a.should == [@u2]
|
102
102
|
end
|
103
103
|
end
|
@@ -118,8 +118,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should return a list of all the company's projects" do
|
121
|
-
get '/api/v1/projects', offset: 0
|
122
|
-
response.should
|
121
|
+
get '/api/v1/projects', params: { offset: 0 }
|
122
|
+
response.should be_successful
|
123
123
|
json.length.should == 2
|
124
124
|
json.map{|c| c['name']}.include?("Manufacture Sprockets").should == true
|
125
125
|
json.map{|c| c['name']}.include?("Disassemble Sprockets").should == true
|
@@ -140,8 +140,8 @@ describe Dummy::ProjectAPI, type: :request do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should return a list of all the project admin's projects" do
|
143
|
-
get '/api/v1/projects', offset: 0
|
144
|
-
response.should
|
143
|
+
get '/api/v1/projects', params: { offset: 0 }
|
144
|
+
response.should be_successful
|
145
145
|
json.length.should == 1
|
146
146
|
json.map{|c| c['name']}.include?("Manufacture Sprockets").should == true
|
147
147
|
json.map{|c| c['name']}.include?("Disassemble Sprockets").should == false
|
@@ -156,7 +156,7 @@ describe Dummy::ProjectAPI, type: :request do
|
|
156
156
|
|
157
157
|
it "should return the project API's declared default paginated results" do
|
158
158
|
get '/api/v1/projects'
|
159
|
-
response.should
|
159
|
+
response.should be_successful
|
160
160
|
json.length.should == 2
|
161
161
|
json.first['id'].should eq Project.all[2].id
|
162
162
|
json.second['id'].should eq Project.all[3].id
|
@@ -164,15 +164,15 @@ describe Dummy::ProjectAPI, type: :request do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should return the request number of results" do
|
167
|
-
get '/api/v1/projects', per_page: 9, offset: 9
|
168
|
-
response.should
|
167
|
+
get '/api/v1/projects', params: { per_page: 9, offset: 9 }
|
168
|
+
response.should be_successful
|
169
169
|
json.size.should == 9
|
170
170
|
json.map {|j| j['id']}.should eq Project.all[9..17].map(&:id)
|
171
171
|
response.headers.slice("X-Total", "X-Total-Pages", "X-Per-Page", "X-Page", "X-Next-Page", "X-Prev-Page", "X-Offset").values.should eq ["20", "2", "9", "1", "2", "", "9"]
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should respect the maximum number of results" do
|
175
|
-
get '/api/v1/projects', per_page: 20, offset: 0
|
175
|
+
get '/api/v1/projects', params: { per_page: 20, offset: 0 }
|
176
176
|
response.code.should eq "400"
|
177
177
|
json['error'].should eq "per_page must be less than 10"
|
178
178
|
end
|
@@ -13,14 +13,14 @@ describe Dummy::RoleAPI, type: :request do
|
|
13
13
|
|
14
14
|
it 'should return a list of user roles' do
|
15
15
|
get '/api/v1/roles'
|
16
|
-
response.should
|
16
|
+
response.should be_successful
|
17
17
|
json.length.should == 1
|
18
18
|
json.first['id'].to_i.should == role.id
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should return the specified user role' do
|
22
22
|
get "/api/v1/roles/#{role.id}"
|
23
|
-
response.should
|
23
|
+
response.should be_successful
|
24
24
|
json['email'].should == role.email
|
25
25
|
end
|
26
26
|
|
@@ -30,13 +30,13 @@ describe Dummy::RoleAPI, type: :request do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should not duplicate user roles' do
|
33
|
-
post '/api/v1/roles', { user_id: user.id, ownable_type: 'Company', ownable_id: company.id }
|
33
|
+
post '/api/v1/roles', params: { user_id: user.id, ownable_type: 'Company', ownable_id: company.id }
|
34
34
|
response.code.should == '400'
|
35
35
|
json['error'].should =~ /user has already been assigned that role/
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'validates ownable type value specified in grape_validations' do
|
39
|
-
post '/api/v1/roles', { user_id: user.id, ownable_type: 'NotCompany' }
|
39
|
+
post '/api/v1/roles', params: { user_id: user.id, ownable_type: 'NotCompany' }
|
40
40
|
response.code.should == '400'
|
41
41
|
json['error'].should eq "ownable_type does not have a valid value"
|
42
42
|
end
|
@@ -12,16 +12,16 @@ describe Dummy::Sessions, type: :request do
|
|
12
12
|
context :sign_in do
|
13
13
|
|
14
14
|
it "should set a user token on login" do
|
15
|
-
post '/api/v1/sessions', { login: user.email, password: 'abc12345', token: true }
|
16
|
-
response.should
|
15
|
+
post '/api/v1/sessions', params: { login: user.email, password: 'abc12345', token: true }
|
16
|
+
response.should be_successful
|
17
17
|
json['id'].to_i.should == user.id
|
18
18
|
json['email'].should == user.email
|
19
19
|
json['authentication_token'].should be_truthy
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should not set a token if the login fails" do
|
23
|
-
post '/api/v1/sessions', { login: user.email, password: 'bad password', token: true }
|
24
|
-
response.should_not
|
23
|
+
post '/api/v1/sessions', params: { login: user.email, password: 'bad password', token: true }
|
24
|
+
response.should_not be_successful
|
25
25
|
json['error'].should be_truthy
|
26
26
|
json['error']['type'].should == 'unauthenticated'
|
27
27
|
user.authentication_token.should be_nil
|
@@ -32,8 +32,8 @@ describe Dummy::Sessions, type: :request do
|
|
32
32
|
it "should reset a user's auth token" do
|
33
33
|
user.authentication_token = "1234567890"
|
34
34
|
user.save!
|
35
|
-
delete "/api/v1/sessions", { api_key: "1234567890" }
|
36
|
-
response.should
|
35
|
+
delete "/api/v1/sessions", params: { api_key: "1234567890" }
|
36
|
+
response.should be_successful
|
37
37
|
user.reload
|
38
38
|
user.authentication_token.should be_nil
|
39
39
|
end
|
@@ -41,12 +41,12 @@ describe Dummy::Sessions, type: :request do
|
|
41
41
|
it "signing out an already signed-out user should look fine, right?" do
|
42
42
|
user.authentication_token = "1234567890"
|
43
43
|
user.save!
|
44
|
-
delete "/api/v1/sessions", { api_key: "1234567890" }
|
45
|
-
response.should
|
44
|
+
delete "/api/v1/sessions", params: { api_key: "1234567890" }
|
45
|
+
response.should be_successful
|
46
46
|
user.reload
|
47
47
|
user.authentication_token.should be_nil
|
48
|
-
delete "/api/v1/sessions", { api_key: "1234567890" }
|
49
|
-
response.should
|
48
|
+
delete "/api/v1/sessions", params: { api_key: "1234567890" }
|
49
|
+
response.should be_successful
|
50
50
|
user.reload
|
51
51
|
user.authentication_token.should be_nil
|
52
52
|
end
|
@@ -5,7 +5,7 @@ describe GrapeSwagger, type: :request do
|
|
5
5
|
|
6
6
|
it "should render swagger docs for the api" do
|
7
7
|
get '/api/v1/swagger_doc'
|
8
|
-
response.should
|
8
|
+
response.should be_successful
|
9
9
|
json = JSON.parse( response.body )
|
10
10
|
if Gem::Version.new( GrapeSwagger::VERSION ) <= Gem::Version.new('0.11.0')
|
11
11
|
json['apiVersion'].should == '0.1'
|
@@ -16,7 +16,7 @@ describe Dummy::UserAPI, type: :request do
|
|
16
16
|
|
17
17
|
it "should return a list of users" do
|
18
18
|
get '/api/v1/users'
|
19
|
-
response.should
|
19
|
+
response.should be_successful
|
20
20
|
json.length.should == 1
|
21
21
|
json.first['id'].to_i.should == user.id
|
22
22
|
json.first['first_name'].should == user.first_name
|
@@ -30,8 +30,8 @@ describe Dummy::UserAPI, type: :request do
|
|
30
30
|
6.times { User.make! }
|
31
31
|
u = User.last
|
32
32
|
u.update_column(:created_at, 1.day.ago)
|
33
|
-
get '/api/v1/users', { created_at_start: 2.day.ago, created_at_end: 8.hours.ago }
|
34
|
-
response.should
|
33
|
+
get '/api/v1/users', params: { created_at_start: 2.day.ago, created_at_end: 8.hours.ago }
|
34
|
+
response.should be_successful
|
35
35
|
json.length.should eq 1
|
36
36
|
json.first['id'].to_i.should eq u.id
|
37
37
|
json.first['first_name'].should eq u.first_name
|
@@ -40,15 +40,15 @@ describe Dummy::UserAPI, type: :request do
|
|
40
40
|
it "should accept a comma separated list of ids" do
|
41
41
|
4.times { User.make! }
|
42
42
|
user_ids = [User.first,User.second,User.third].map(&:id)
|
43
|
-
get '/api/v1/users', { id: user_ids.join(',') }
|
44
|
-
response.should
|
43
|
+
get '/api/v1/users', params: { id: user_ids.join(',') }
|
44
|
+
response.should be_successful
|
45
45
|
json.length.should eq 3
|
46
46
|
json.map {|j| j['id'] }.should eq user_ids
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should not expose users' encrypted_passwords" do
|
50
50
|
get "/api/v1/users"
|
51
|
-
response.should
|
51
|
+
response.should be_successful
|
52
52
|
json.first['encrypted_password'].should be_nil
|
53
53
|
end
|
54
54
|
end
|
@@ -57,13 +57,13 @@ describe Dummy::UserAPI, type: :request do
|
|
57
57
|
context :show do
|
58
58
|
it "should return the specified user" do
|
59
59
|
get "/api/v1/users/#{user.id}"
|
60
|
-
response.should
|
60
|
+
response.should be_successful
|
61
61
|
json['email'].should == user.email
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should not expose a user's encrypted_password" do
|
65
65
|
get "/api/v1/users/#{user.id}"
|
66
|
-
response.should
|
66
|
+
response.should be_successful
|
67
67
|
json['encrypted_password'].should be_nil
|
68
68
|
end
|
69
69
|
|
@@ -77,31 +77,31 @@ describe Dummy::UserAPI, type: :request do
|
|
77
77
|
context :create do
|
78
78
|
|
79
79
|
it "should create a user and send the confirmation email" do
|
80
|
-
post "/api/v1/users", { email: 'email@test.com', password: 'abc12345' }
|
81
|
-
response.should
|
80
|
+
post "/api/v1/users", params: { email: 'email@test.com', password: 'abc12345' }
|
81
|
+
response.should be_successful
|
82
82
|
json['email'].should == user.email
|
83
83
|
User.last.confirmed_at.should == nil
|
84
84
|
User.last.confirmation_sent_at.should_not == nil
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should create a user and skip the confirmation email" do
|
88
|
-
post "/api/v1/users", { email: 'email@test.com', password: 'abc12345', skip_confirmation_email: true }
|
89
|
-
response.should
|
88
|
+
post "/api/v1/users", params: { email: 'email@test.com', password: 'abc12345', skip_confirmation_email: true }
|
89
|
+
response.should be_successful
|
90
90
|
json['email'].should == user.email
|
91
91
|
User.last.confirmed_at.should_not == nil
|
92
92
|
User.last.confirmation_sent_at.should == nil
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should validate a new user" do
|
96
|
-
post "/api/v1/users", { email: 'a'*257, password: '' }
|
96
|
+
post "/api/v1/users", params: { email: 'a'*257, password: '' }
|
97
97
|
response.code.should == "400"
|
98
98
|
json['error'].should == "Email: is invalid, Password: can't be blank"
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should return only the records that were created at a nested endpoint" do
|
102
102
|
new_company = Company.make!
|
103
|
-
post "/api/v1/users/#{user.id}/roles", {ownable_type: 'Company', ownable_id: new_company.id}
|
104
|
-
response.should
|
103
|
+
post "/api/v1/users/#{user.id}/roles", params: {ownable_type: 'Company', ownable_id: new_company.id}
|
104
|
+
response.should be_successful
|
105
105
|
json.size.should eq 1
|
106
106
|
json.first['ownable_id'].should eq new_company.id
|
107
107
|
end
|
@@ -117,8 +117,8 @@ describe Dummy::UserAPI, type: :request do
|
|
117
117
|
|
118
118
|
it "should create a company admin" do
|
119
119
|
params[:roles_attributes].push(role)
|
120
|
-
post "/api/v1/users", params
|
121
|
-
response.should
|
120
|
+
post "/api/v1/users", params: params
|
121
|
+
response.should be_successful
|
122
122
|
User.last.admin?(company).should be_truthy
|
123
123
|
end
|
124
124
|
|
@@ -134,15 +134,15 @@ describe Dummy::UserAPI, type: :request do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should set an empty password to an assigned project's default password" do
|
137
|
-
post "/api/v1/users", params
|
138
|
-
response.should
|
137
|
+
post "/api/v1/users", params: params
|
138
|
+
response.should be_successful
|
139
139
|
json['user_project_jobs_attributes'][0]['name'].should == project.name
|
140
140
|
json['user_project_jobs_attributes'][0]['title'].should == job.title
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should return a validation error if the user's assigned project has no default password" do
|
144
144
|
project.update_attributes(default_password: nil)
|
145
|
-
post "/api/v1/users", params
|
145
|
+
post "/api/v1/users", params: params
|
146
146
|
response.status.should == 400
|
147
147
|
json['error'].should == "Password: can't be blank"
|
148
148
|
end
|
@@ -154,10 +154,9 @@ describe Dummy::UserAPI, type: :request do
|
|
154
154
|
it "should upload a user avatar via the root route" do
|
155
155
|
params = { avatar_attributes: { file: Rack::Test::UploadedFile.new(Rails.root+'../fixtures/images/avatar.jpeg', 'image/jpeg', true) } }
|
156
156
|
|
157
|
-
put "/api/v1/users/#{user.id}", params
|
157
|
+
put "/api/v1/users/#{user.id}", params: params
|
158
158
|
|
159
|
-
|
160
|
-
response.should be_success
|
159
|
+
response.should be_successful
|
161
160
|
json['avatar_url'].should eq Image.last.file.url(:medium)
|
162
161
|
user.avatar.should eq Image.last
|
163
162
|
user.avatar_url.should eq Image.last.file.url(:medium)
|
@@ -166,10 +165,9 @@ describe Dummy::UserAPI, type: :request do
|
|
166
165
|
it "should upload a user avatar via the nested route, to test the restful api's handling of has_one associations" do
|
167
166
|
params = { file: Rack::Test::UploadedFile.new(Rails.root+'../fixtures/images/avatar.jpeg', 'image/jpeg', true) }
|
168
167
|
|
169
|
-
post "/api/v1/users/#{user.id}/avatars", params
|
168
|
+
post "/api/v1/users/#{user.id}/avatars", params: params
|
170
169
|
|
171
|
-
|
172
|
-
response.should be_success
|
170
|
+
response.should be_successful
|
173
171
|
user.avatar.should == Image.last
|
174
172
|
user.avatar_url.should == Image.last.file.url(:medium)
|
175
173
|
user.avatar_url
|
@@ -178,8 +176,8 @@ describe Dummy::UserAPI, type: :request do
|
|
178
176
|
it "should require a devise re-confirmation email to update a user's email address" do
|
179
177
|
new_email = 'new.email@test.com'
|
180
178
|
old_email = user.email
|
181
|
-
put "/api/v1/users/#{user.id}", { email: new_email }
|
182
|
-
response.should
|
179
|
+
put "/api/v1/users/#{user.id}", params: { email: new_email }
|
180
|
+
response.should be_successful
|
183
181
|
user.reload
|
184
182
|
user.email.should == old_email
|
185
183
|
user.unconfirmed_email.should == new_email
|
@@ -188,16 +186,16 @@ describe Dummy::UserAPI, type: :request do
|
|
188
186
|
|
189
187
|
it "should skip the confirmation and update a user's email address" do
|
190
188
|
new_email = 'new.email@test.com'
|
191
|
-
put "/api/v1/users/#{user.id}", { email: new_email, skip_confirmation_email: true }
|
192
|
-
response.should
|
189
|
+
put "/api/v1/users/#{user.id}", params: { email: new_email, skip_confirmation_email: true }
|
190
|
+
response.should be_successful
|
193
191
|
json['email'].should == new_email
|
194
192
|
user.reload
|
195
193
|
user.email.should == new_email
|
196
194
|
end
|
197
195
|
|
198
196
|
it "should validate the uniqueness of a user role" do
|
199
|
-
put "/api/v1/users/#{user.id}", { roles_attributes: [{ownable_type: 'Company', ownable_id: company.id}] }
|
200
|
-
response.should_not
|
197
|
+
put "/api/v1/users/#{user.id}", params: { roles_attributes: [{ownable_type: 'Company', ownable_id: company.id}] }
|
198
|
+
response.should_not be_successful
|
201
199
|
json['error'].should =~ /user has already been assigned that role/
|
202
200
|
user.admin?(company).should be_truthy
|
203
201
|
end
|
@@ -205,16 +203,16 @@ describe Dummy::UserAPI, type: :request do
|
|
205
203
|
it "should update a user to be company admin" do
|
206
204
|
c = Company.make
|
207
205
|
c.save!
|
208
|
-
put "/api/v1/users/#{user.id}", { roles_attributes: [{ownable_type: 'Company', ownable_id: c.id}] }
|
209
|
-
response.should
|
206
|
+
put "/api/v1/users/#{user.id}", params: { roles_attributes: [{ownable_type: 'Company', ownable_id: c.id}] }
|
207
|
+
response.should be_successful
|
210
208
|
user.reload
|
211
209
|
user.admin?(c).should be_truthy
|
212
210
|
end
|
213
211
|
|
214
212
|
it "should destroy a user's company admin role" do
|
215
213
|
user.admin?(company).should be_truthy
|
216
|
-
put "/api/v1/users/#{user.id}", { roles_attributes: [{id: user.roles.last.id, _destroy: '1'}] }
|
217
|
-
response.should
|
214
|
+
put "/api/v1/users/#{user.id}", params: { roles_attributes: [{id: user.roles.last.id, _destroy: '1'}] }
|
215
|
+
response.should be_successful
|
218
216
|
user.reload
|
219
217
|
user.admin?(company).should be_falsey
|
220
218
|
end
|
metadata
CHANGED
@@ -1,49 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: introspective_grape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Buermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-22 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
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.0.0
|
20
|
-
- - "<"
|
17
|
+
- - ">"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 5.0.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.0.0
|
30
|
-
- - "<"
|
24
|
+
- - ">"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 5.0.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: grape
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "
|
31
|
+
- - "<"
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
33
|
+
version: 1.0.0
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- - "
|
38
|
+
- - "<"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
version: 1.0.0
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: grape-entity
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,16 +98,16 @@ dependencies:
|
|
104
98
|
name: pundit
|
105
99
|
requirement: !ruby/object:Gem::Requirement
|
106
100
|
requirements:
|
107
|
-
- - "
|
101
|
+
- - ">="
|
108
102
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
103
|
+
version: '0'
|
110
104
|
type: :runtime
|
111
105
|
prerelease: false
|
112
106
|
version_requirements: !ruby/object:Gem::Requirement
|
113
107
|
requirements:
|
114
|
-
- - "
|
108
|
+
- - ">="
|
115
109
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
110
|
+
version: '0'
|
117
111
|
- !ruby/object:Gem::Dependency
|
118
112
|
name: camel_snake_keys
|
119
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,16 +126,16 @@ dependencies:
|
|
132
126
|
name: sqlite3
|
133
127
|
requirement: !ruby/object:Gem::Requirement
|
134
128
|
requirements:
|
135
|
-
- - "
|
129
|
+
- - "<"
|
136
130
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
131
|
+
version: 1.4.0
|
138
132
|
type: :development
|
139
133
|
prerelease: false
|
140
134
|
version_requirements: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
|
-
- - "
|
136
|
+
- - "<"
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
138
|
+
version: 1.4.0
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
140
|
name: rspec-rails
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,18 +168,18 @@ dependencies:
|
|
174
168
|
name: paperclip
|
175
169
|
requirement: !ruby/object:Gem::Requirement
|
176
170
|
requirements:
|
177
|
-
- - "
|
171
|
+
- - ">="
|
178
172
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
173
|
+
version: 5.2.0
|
180
174
|
type: :development
|
181
175
|
prerelease: false
|
182
176
|
version_requirements: !ruby/object:Gem::Requirement
|
183
177
|
requirements:
|
184
|
-
- - "
|
178
|
+
- - ">="
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
180
|
+
version: 5.2.0
|
187
181
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
182
|
+
name: machinist_redux
|
189
183
|
requirement: !ruby/object:Gem::Requirement
|
190
184
|
requirements:
|
191
185
|
- - ">="
|
@@ -256,10 +250,15 @@ files:
|
|
256
250
|
- gemfiles/2.2.0-Gemfile
|
257
251
|
- gemfiles/Gemfile.rails.3.2.22
|
258
252
|
- gemfiles/Gemfile.rails.4.1.13
|
253
|
+
- gemfiles/Gemfile.rails.4.2.10
|
259
254
|
- gemfiles/Gemfile.rails.4.2.7.1
|
260
255
|
- gemfiles/Gemfile.rails.4.2.7.1.new.swagger
|
261
256
|
- gemfiles/Gemfile.rails.4.2.8
|
257
|
+
- gemfiles/Gemfile.rails.5.0.0
|
262
258
|
- gemfiles/Gemfile.rails.5.0.1
|
259
|
+
- gemfiles/Gemfile.rails.5.1.0
|
260
|
+
- gemfiles/Gemfile.rails.5.2.0
|
261
|
+
- gemfiles/Gemfile.rails.6.0.0.beta1
|
263
262
|
- gemfiles/Gemfile.rails.master
|
264
263
|
- introspective_grape.gemspec
|
265
264
|
- lib/introspective_grape.rb
|
@@ -429,7 +428,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
429
428
|
requirements:
|
430
429
|
- - "~>"
|
431
430
|
- !ruby/object:Gem::Version
|
432
|
-
version: '2.
|
431
|
+
version: '2.1'
|
433
432
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
434
433
|
requirements:
|
435
434
|
- - ">="
|