json_voorhees 0.3.6 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/json_voorhees/app_make_user/app_make_user_generator.rb +7 -3
- data/lib/generators/json_voorhees/app_make_user/templates/user/specs/model_specs.rb +2 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/specs/no_arcadex_request_specs.rb +85 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/specs/route_specs.rb +2 -1
- data/lib/generators/json_voorhees/app_make_user/templates/user/user_authorizations.rb +4 -0
- data/lib/generators/json_voorhees/app_make_user/templates/user/user_model.rb +3 -1
- data/lib/generators/json_voorhees/app_make_user/templates/user/user_routes.rb +2 -0
- data/lib/generators/json_voorhees/app_scaffold/app_scaffold_generator.rb +2 -2
- data/lib/generators/json_voorhees/engine_scaffold/engine_scaffold_generator.rb +2 -2
- data/lib/generators/json_voorhees/massive_scaffold/massive_scaffold_generator.rb +2 -2
- data/lib/json_voorhees/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8daf1dd808cd2380474ca030214738f5f374d955
|
4
|
+
data.tar.gz: 7825f326e02cc3e3de7991468573dfbe320047fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f249015ad3a6069d3911cd9b0e3cc3b1969bf29d4ba2dc83aa817f847ac9ecc836da80879fd16046950450b0743989b7984a011508e2a8de84f0110a8bde3d
|
7
|
+
data.tar.gz: 0c9d17b1cdf174308ac7d1ac9e23d518e1734fc6652e22229a1fcf7d10da66ff11ac1a951c55d6b660ee3766dd1969adf051ffbecb5410eda9ff4aca61f44ec2
|
@@ -25,8 +25,8 @@ module JsonVoorhees
|
|
25
25
|
end
|
26
26
|
#Need to add the engine to the main_apps gemfile
|
27
27
|
route "mount People::Engine, at: \'/\'"
|
28
|
+
copy_user_files_over
|
28
29
|
if options.arcadex?
|
29
|
-
copy_user_files_over
|
30
30
|
route "mount Arcadex::Engine, at: \'/\'"
|
31
31
|
end
|
32
32
|
insert_people_engine
|
@@ -62,8 +62,12 @@ gem 'people', :path => "engines/people"
|
|
62
62
|
template "user/user_serializer.rb", "engines/people/app/serializers/people/v1/user_serializer.rb"
|
63
63
|
template "user/specs/factory_girl.rb", "spec/factories/people_user_1_factory.rb"
|
64
64
|
template "user/specs/model_specs.rb", "spec/engines/people/api/v1/models/user_spec.rb"
|
65
|
-
|
66
|
-
|
65
|
+
if options.arcadex?
|
66
|
+
template "user/specs/request_specs.rb", "spec/engines/people/api/v1/requests/user_spec.rb"
|
67
|
+
else
|
68
|
+
template "user/specs/no_arcadex_request_specs.rb", "spec/engines/people/api/v1/requests/user_spec.rb"
|
69
|
+
end
|
70
|
+
template "user/specs/route_specs.rb", "spec/engines/people/api/v1/routing/user_spec.rb"
|
67
71
|
end
|
68
72
|
|
69
73
|
end
|
@@ -49,11 +49,13 @@ RSpec.describe ::People::V1::User, :type => :model do
|
|
49
49
|
before(:example) do
|
50
50
|
@user = FactoryGirl.create(:people_user_1)
|
51
51
|
end
|
52
|
+
<% if options.arcadex? %>
|
52
53
|
it "creates an authentication token" do
|
53
54
|
expect(@user.tokens.any?).to equal(true)
|
54
55
|
end
|
55
56
|
it "does not create an empty auth token" do
|
56
57
|
expect(@user.tokens[0].auth_token.nil?).to equal(false)
|
57
58
|
end
|
59
|
+
<% end %>
|
58
60
|
end
|
59
61
|
end
|
data/lib/generators/json_voorhees/app_make_user/templates/user/specs/no_arcadex_request_specs.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
#-#-#-#-#REST#-#-#-#-#
|
4
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
5
|
+
describe "Index" do
|
6
|
+
before(:example) do
|
7
|
+
@user = FactoryGirl.create(:people_user_1)
|
8
|
+
end
|
9
|
+
# get /api/1/users
|
10
|
+
it "checks index json response" do
|
11
|
+
FactoryGirl.create_list(:people_user_1, 10)
|
12
|
+
get 'api/1/users'
|
13
|
+
expect(response.status).to eq(200) #ok
|
14
|
+
expect(json["users"]).to_not eq(nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
19
|
+
describe "Show" do
|
20
|
+
before(:example) do
|
21
|
+
@user = FactoryGirl.create(:people_user_1)
|
22
|
+
end
|
23
|
+
# get /api/1/users/1
|
24
|
+
it "checks show json response" do
|
25
|
+
get 'api/1/users/1'
|
26
|
+
expect(response.status).to eq(200) #ok
|
27
|
+
expect(json["user"]["id"]).to eq(1)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
32
|
+
describe "Update" do
|
33
|
+
before(:example) do
|
34
|
+
@user = FactoryGirl.create(:people_user_1)
|
35
|
+
end
|
36
|
+
# put /api/1/users/1
|
37
|
+
it "checks update json response" do
|
38
|
+
attrs = FactoryGirl.attributes_for(:people_user_1)
|
39
|
+
attrs["email"] = "Cole@LaunchU.com"
|
40
|
+
hash = {"user" => attrs}
|
41
|
+
put 'api/1/users/1', hash
|
42
|
+
expect(response.status).to eq(200) #ok
|
43
|
+
expect(json["user"]["email"]).to eq("Cole@LaunchU.com")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
#-#-#-#-#Collection Routes#-#-#-#-#
|
48
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
49
|
+
describe "Collection" do
|
50
|
+
before(:example) do
|
51
|
+
@attrs = FactoryGirl.attributes_for(:people_user_1)
|
52
|
+
end
|
53
|
+
it "Collection" do
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
#-#-#-#-#Serialization#-#-#-#-#
|
58
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
59
|
+
describe "Serialization" do
|
60
|
+
before(:example) do
|
61
|
+
@user = FactoryGirl.create(:people_user_1)
|
62
|
+
end
|
63
|
+
# get /api/1/users
|
64
|
+
it "checks only appropriate attributes are sent back for index" do
|
65
|
+
FactoryGirl.create_list(:people_user_1, 10)
|
66
|
+
get 'api/1/users'
|
67
|
+
expect(response.status).to eq(200) #ok
|
68
|
+
expect(json["users"][0]["password_digest"]).to eq(nil)
|
69
|
+
expect(json["users"][0]["created_at"]).to_not eq(nil)
|
70
|
+
expect(json["users"][0]["updated_at"]).to_not eq(nil)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
#-#-#-#-#Errors#-#-#-#-#
|
75
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
76
|
+
describe "Authorization" do
|
77
|
+
before(:example) do
|
78
|
+
@user = FactoryGirl.create(:people_user_1)
|
79
|
+
end
|
80
|
+
it "checks for 404 response" do
|
81
|
+
get 'api/1/users/20'
|
82
|
+
expect(response.status).to eq(404) #not_found
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rails_helper"
|
2
|
-
|
2
|
+
<% if options.arcadex? %>
|
3
3
|
#The register, login, and logout routes
|
4
4
|
RSpec.describe "Users sign up process routing", :type => :routing do
|
5
5
|
routes { People::Engine.routes }
|
@@ -23,6 +23,7 @@ RSpec.describe "Users sign up process routing", :type => :routing do
|
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
26
|
+
<% end %>
|
26
27
|
#The standard rest routes for the user controller
|
27
28
|
RSpec.describe "Users controller rest routing", :type => :routing do
|
28
29
|
routes { People::Engine.routes }
|
@@ -29,12 +29,16 @@ module Authorization
|
|
29
29
|
|
30
30
|
|
31
31
|
def self.update?(targetUser,tokenUser)
|
32
|
+
<% if options.arcadex? %>
|
32
33
|
if targetUser != tokenUser
|
33
34
|
#Can only update your own data
|
34
35
|
return false
|
35
36
|
else
|
36
37
|
return true
|
37
38
|
end
|
39
|
+
<% else %>
|
40
|
+
return true
|
41
|
+
<% end %>
|
38
42
|
end
|
39
43
|
|
40
44
|
#Used in the serializer, current_user may be nil
|
@@ -11,6 +11,7 @@ People::Engine.routes.draw do
|
|
11
11
|
scope 'api' do
|
12
12
|
scope '1' do
|
13
13
|
resources :users, controller: 'api/v1/users' do
|
14
|
+
<% if options.arcadex? %>
|
14
15
|
collection do
|
15
16
|
# /api/1/users/register
|
16
17
|
post 'register', to: "api/v1/users#register"
|
@@ -19,6 +20,7 @@ People::Engine.routes.draw do
|
|
19
20
|
# /api/1/users/logout
|
20
21
|
get 'logout', to: "api/v1/users#logout"
|
21
22
|
end
|
23
|
+
<% end %>
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
@@ -16,8 +16,8 @@ module JsonVoorhees
|
|
16
16
|
run "rails g json_voorhees:app_make_authorizations #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
17
17
|
run "rails g json_voorhees:app_make_tests #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
18
18
|
else
|
19
|
-
run "rails g json_voorhees:app_make_authorizations
|
20
|
-
run "rails g json_voorhees:app_make_tests
|
19
|
+
run "rails g json_voorhees:app_make_authorizations #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
20
|
+
run "rails g json_voorhees:app_make_tests #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -13,8 +13,8 @@ module JsonVoorhees
|
|
13
13
|
run "rails g json_voorhees:engine_create_controller #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
14
14
|
run "rails g json_voorhees:engine_create_serializer #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
15
15
|
else
|
16
|
-
run "rails g json_voorhees:engine_create_controller
|
17
|
-
run "rails g json_voorhees:engine_create_serializer
|
16
|
+
run "rails g json_voorhees:engine_create_controller #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
17
|
+
run "rails g json_voorhees:engine_create_serializer #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
18
18
|
end
|
19
19
|
if options.model?
|
20
20
|
run "rails g json_voorhees:engine_create_model #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
@@ -25,13 +25,13 @@ module JsonVoorhees
|
|
25
25
|
if options.arcadex?
|
26
26
|
run "rails g json_voorhees:engine_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
27
27
|
else
|
28
|
-
run "rails g json_voorhees:engine_scaffold
|
28
|
+
run "rails g json_voorhees:engine_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
if options.arcadex?
|
32
32
|
run "rails g json_voorhees:app_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
|
33
33
|
else
|
34
|
-
run "rails g json_voorhees:app_scaffold
|
34
|
+
run "rails g json_voorhees:app_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")} --skip-arcadex"
|
35
35
|
end
|
36
36
|
if options.active_admin?
|
37
37
|
run "rails generate active_admin:resource #{module_name.underscore.downcase}::#{resource_name.singularize.underscore.downcase}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_voorhees
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cleophus Robinson
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/generators/json_voorhees/app_make_user/templates/user/include_authorization.rb
|
79
79
|
- lib/generators/json_voorhees/app_make_user/templates/user/specs/factory_girl.rb
|
80
80
|
- lib/generators/json_voorhees/app_make_user/templates/user/specs/model_specs.rb
|
81
|
+
- lib/generators/json_voorhees/app_make_user/templates/user/specs/no_arcadex_request_specs.rb
|
81
82
|
- lib/generators/json_voorhees/app_make_user/templates/user/specs/request_specs.rb
|
82
83
|
- lib/generators/json_voorhees/app_make_user/templates/user/specs/route_specs.rb
|
83
84
|
- lib/generators/json_voorhees/app_make_user/templates/user/user_authorizations.rb
|