json_voorhees 0.4.9 → 0.5.0
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/lib/generators/json_voorhees/app_make_user/templates/user/specs/request_specs.rb +31 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/specs/route_specs.rb +6 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/user_controller.rb +6 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/user_routes.rb +2 -0
- data/lib/json_voorhees/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4478a2de618d0f1f394dad97b96ea8b80f5b4f3c
|
|
4
|
+
data.tar.gz: 51ba36b296823599cf4321aff4f7c4e7c9726f2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2e3da6c1d2997fb68583987e4049bf9aa6a26c21bfc73a5d588d7ec809554b823daec59d9fab55c88f2c5f399e673266c4a05657b96947e4018b1456a2282b5
|
|
7
|
+
data.tar.gz: 75ef0de7b160a5f02be36db51ceae726690cde39b54706961f2effade5bd64fa0f41b9717af60a2e970dbcf130e0dd80114be13b08f26aa9773c890139a5dc9d
|
|
@@ -176,6 +176,37 @@ RSpec.describe ::People::V1::User, :type => :request do
|
|
|
176
176
|
end
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
|
180
|
+
describe "Login_Status" do
|
|
181
|
+
before(:example) do
|
|
182
|
+
@attrs = FactoryGirl.attributes_for(:people_user_1)
|
|
183
|
+
end
|
|
184
|
+
# get /api/1/users/login_status
|
|
185
|
+
it "returns 200 okay if token is valid" do
|
|
186
|
+
user = FactoryGirl.create(:people_user_1,@attrs)
|
|
187
|
+
token = user.tokens[0].auth_token
|
|
188
|
+
header = {"Auth-Token" => token, "Email" => user.email}
|
|
189
|
+
get "api/1/users/login_status", nil, header
|
|
190
|
+
expect(response.status).to eq(200) #ok
|
|
191
|
+
end
|
|
192
|
+
# get /api/1/users/login_status
|
|
193
|
+
it "returns a 401 if token is not valid" do
|
|
194
|
+
user = FactoryGirl.create(:people_user_1,@attrs)
|
|
195
|
+
token = user.tokens[0].auth_token + "not_valid"
|
|
196
|
+
header = {"Auth-Token" => token, "Email" => user.email}
|
|
197
|
+
get "api/1/users/login_status", nil, header
|
|
198
|
+
expect(response.status).to eq(401) #unauthorized
|
|
199
|
+
end
|
|
200
|
+
# get /api/1/users/login_status
|
|
201
|
+
it "returns a 401 if token does not exist" do
|
|
202
|
+
user = FactoryGirl.create(:people_user_1,@attrs)
|
|
203
|
+
token = user.tokens[0].auth_token
|
|
204
|
+
header = {"Email" => user.email}
|
|
205
|
+
get "api/1/users/login_status", nil, header
|
|
206
|
+
expect(response.status).to eq(401) #unauthorized
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
179
210
|
#-#-#-#-#Serialization#-#-#-#-#
|
|
180
211
|
RSpec.describe ::People::V1::User, :type => :request do
|
|
181
212
|
describe "Serialization" do
|
|
@@ -29,6 +29,12 @@ RSpec.describe "Users sign up process routing", :type => :routing do
|
|
|
29
29
|
:id => "1"
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
|
+
it "routes to login_status" do
|
|
33
|
+
expect(:get => "/api/1/users/login_status").to route_to(
|
|
34
|
+
:controller => "people/api/v1/users",
|
|
35
|
+
:action => "login_status"
|
|
36
|
+
)
|
|
37
|
+
end
|
|
32
38
|
end
|
|
33
39
|
<% end %>
|
|
34
40
|
#The standard rest routes for the user controller
|
|
@@ -21,6 +21,8 @@ People::Engine.routes.draw do
|
|
|
21
21
|
post 'logout', to: "api/v1/users#logout"
|
|
22
22
|
# /api/1/users/logout
|
|
23
23
|
post 'authenticate/:id', to: "api/v1/users#authenticate"
|
|
24
|
+
# /api/1/users/login_status
|
|
25
|
+
get 'login_status', to: "api/v1/users#login_status"
|
|
24
26
|
end
|
|
25
27
|
<% end %>
|
|
26
28
|
end
|