people_user_generator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/people/account.js +2 -0
- data/app/assets/javascripts/people/application.js +13 -0
- data/app/assets/stylesheets/people/account.css +7 -0
- data/app/assets/stylesheets/people/application.css +15 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/people/account_controller.rb +86 -0
- data/app/controllers/people/api/v1/application_controller.rb +5 -0
- data/app/controllers/people/api/v1/authentication_controller.rb +140 -0
- data/app/controllers/people/api/v1/users_controller.rb +120 -0
- data/app/controllers/people/application_controller.rb +4 -0
- data/app/helpers/people/account_helper.rb +4 -0
- data/app/helpers/people/application_helper.rb +4 -0
- data/app/helpers/people/users_helper.rb +4 -0
- data/app/mailers/people/account_mailer.rb +68 -0
- data/app/models/people/email_hash.rb +44 -0
- data/app/models/people/user.rb +9 -0
- data/app/models/people/v1/user.rb +54 -0
- data/app/serializers/people/v1/user_serializer.rb +61 -0
- data/app/views/layouts/people/application.html.erb +14 -0
- data/app/views/layouts/people/default/application.html.erb +14 -0
- data/app/views/people/account/changed_password.html.erb +3 -0
- data/app/views/people/account/email_confirm.html.erb +3 -0
- data/app/views/people/account/forgotten_password.html.erb +12 -0
- data/app/views/people/account/new_password.html.erb +25 -0
- data/app/views/people/account/posted_email_sent.html.erb +3 -0
- data/app/views/people/account_mailer/email_confirmation.html.erb +14 -0
- data/app/views/people/account_mailer/email_confirmation.text.erb +5 -0
- data/app/views/people/account_mailer/forgot_password.html.erb +15 -0
- data/app/views/people/account_mailer/forgot_password.text.erb +8 -0
- data/app/views/people/account_mailer/password_reset.html.erb +10 -0
- data/app/views/people/account_mailer/password_reset.text.erb +3 -0
- data/app/views/people/account_mailer/unlock_account.html.erb +14 -0
- data/app/views/people/account_mailer/unlock_account.text.erb +7 -0
- data/app/views/people/account_mailer/welcome_email.html.erb +15 -0
- data/app/views/people/account_mailer/welcome_email.text.erb +6 -0
- data/app/views/people/account_mailer/you_confirmed_email.html.erb +10 -0
- data/app/views/people/account_mailer/you_confirmed_email.text.erb +3 -0
- data/config/routes.rb +29 -0
- data/db/migrate/20141021150908_create_people_users.rb +13 -0
- data/db/migrate/20141022145945_create_people_email_hashes.rb +11 -0
- data/db/migrate/20141022161442_add_confirmed_to_people_users.rb +5 -0
- data/db/migrate/20141022161524_add_locked_to_people_users.rb +5 -0
- data/db/migrate/20141022161543_add_attempts_to_people_users.rb +5 -0
- data/db/migrate/20141023203747_remove_hash_from_people_email_hash.rb +5 -0
- data/db/migrate/20141023203806_add_token_to_people_email_hash.rb +5 -0
- data/db/migrate/20141024042651_remove_type_from_people_email_hash.rb +5 -0
- data/db/migrate/20141024042708_add_email_type_to_people_email_hash.rb +5 -0
- data/lib/generators/people/admin/USAGE +8 -0
- data/lib/generators/people/admin/admin_generator.rb +17 -0
- data/lib/generators/people/admin/templates/active_admin.rb +100 -0
- data/lib/generators/people/admin/templates/email_hash.rb +82 -0
- data/lib/generators/people/all/USAGE +8 -0
- data/lib/generators/people/all/all_generator.rb +18 -0
- data/lib/generators/people/authorizations/USAGE +8 -0
- data/lib/generators/people/authorizations/authorizations_generator.rb +19 -0
- data/lib/generators/people/authorizations/templates/authentication_authorization.rb +25 -0
- data/lib/generators/people/authorizations/templates/authorization.rb +106 -0
- data/lib/generators/people/tests/USAGE +8 -0
- data/lib/generators/people/tests/templates/account_routing.rb +37 -0
- data/lib/generators/people/tests/templates/authentication_requests.rb +166 -0
- data/lib/generators/people/tests/templates/authentication_routing.rb +37 -0
- data/lib/generators/people/tests/templates/email_hash_factory.rb +7 -0
- data/lib/generators/people/tests/templates/email_hash_model.rb +14 -0
- data/lib/generators/people/tests/templates/email_hash_request.rb +174 -0
- data/lib/generators/people/tests/templates/factory.rb +17 -0
- data/lib/generators/people/tests/templates/models.rb +61 -0
- data/lib/generators/people/tests/templates/requests.rb +180 -0
- data/lib/generators/people/tests/templates/routing.rb +47 -0
- data/lib/generators/people/tests/tests_generator.rb +25 -0
- data/lib/people.rb +4 -0
- data/lib/people/engine.rb +5 -0
- data/lib/people/version.rb +3 -0
- data/lib/tasks/people_tasks.rake +4 -0
- data/test/controllers/people/account_controller_test.rb +21 -0
- data/test/controllers/people/users_controller_test.rb +51 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +38 -0
- data/test/dummy/log/development.log +122 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/people/email_hashes.yml +11 -0
- data/test/fixtures/people/users.yml +11 -0
- data/test/helpers/people/account_helper_test.rb +6 -0
- data/test/helpers/people/users_helper_test.rb +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/mailers/people/account_mailer_test.rb +9 -0
- data/test/mailers/previews/people/account_mailer_preview.rb +6 -0
- data/test/models/people/email_hash_test.rb +9 -0
- data/test/models/people/user_test.rb +9 -0
- data/test/people_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +353 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
sequence :username do |n|
|
3
|
+
"username#{n}"
|
4
|
+
end
|
5
|
+
sequence :email do |n|
|
6
|
+
"username#{n}@LaunchU.com"
|
7
|
+
end
|
8
|
+
factory :people_user_1, class: ::People::V1::User do
|
9
|
+
username
|
10
|
+
email
|
11
|
+
password "password123"
|
12
|
+
password_confirmation "password123"
|
13
|
+
attempts 0
|
14
|
+
confirmed false
|
15
|
+
locked false
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.describe ::People::V1::User, '.username', :type => :model do
|
4
|
+
it "does not save when nil" do
|
5
|
+
user = FactoryGirl.build(:people_user_1, :username => nil)
|
6
|
+
expect(user.save).to equal(false)
|
7
|
+
end
|
8
|
+
it "does not save with invalid characters" do
|
9
|
+
#user = FactoryGirl.build(:people_user_1, :username => "!@#$%)")
|
10
|
+
#expect(user.save).to equal(false)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
RSpec.describe ::People::V1::User, '.email', :type => :model do
|
14
|
+
it "does not save when nil" do
|
15
|
+
user = FactoryGirl.build(:people_user_1, :email => nil)
|
16
|
+
expect(user.save).to equal(false)
|
17
|
+
end
|
18
|
+
it "does not save with invalid characters" do
|
19
|
+
#user = FactoryGirl.build(:people_user_1, :email => "!@#$%)")
|
20
|
+
#expect(user.save).to equal(false)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
RSpec.describe ::People::V1::User, '.password_digest', :type => :model do
|
24
|
+
it "does not save when nil" do
|
25
|
+
user = FactoryGirl.build(:people_user_1, :password => nil, :password_confirmation => nil)
|
26
|
+
expect(user.save).to equal(false)
|
27
|
+
end
|
28
|
+
it "does not save when not a match" do
|
29
|
+
user = FactoryGirl.build(:people_user_1, :password => "firstAttempt", :password_confirmation => "secondAttempt")
|
30
|
+
expect(user.save).to equal(false)
|
31
|
+
end
|
32
|
+
it "saves with a matching password and password_confirmation" do
|
33
|
+
user = FactoryGirl.build(:people_user_1, :password => "good_password", :password_confirmation => "good_password")
|
34
|
+
expect(user.save).to equal(true)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
RSpec.describe ::People::V1::User, :type => :model do
|
38
|
+
describe "dependencies" do
|
39
|
+
before(:example) do
|
40
|
+
@user = FactoryGirl.create(:people_user_1)
|
41
|
+
end
|
42
|
+
it "deletes ... when deleted" do
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
RSpec.describe ::People::V1::User, :type => :model do
|
48
|
+
describe "callbacks" do
|
49
|
+
before(:example) do
|
50
|
+
@user = FactoryGirl.create(:people_user_1)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "creates an authentication token" do
|
54
|
+
expect(@user.tokens.any?).to equal(true)
|
55
|
+
end
|
56
|
+
it "does not create an empty auth token" do
|
57
|
+
expect(@user.tokens[0].auth_token.nil?).to equal(false)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,180 @@
|
|
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
|
+
token = @user.tokens[0].auth_token
|
9
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
10
|
+
end
|
11
|
+
# get /api/1/users
|
12
|
+
it "checks index json response" do
|
13
|
+
FactoryGirl.create_list(:people_user_1, 10)
|
14
|
+
get 'api/1/users', nil, @header
|
15
|
+
expect(response.status).to eq(200) #ok
|
16
|
+
expect(json["users"]).to_not eq(nil)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
21
|
+
describe "Show" do
|
22
|
+
before(:example) do
|
23
|
+
@user = FactoryGirl.create(:people_user_1)
|
24
|
+
token = @user.tokens[0].auth_token
|
25
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
26
|
+
end
|
27
|
+
# get /api/1/users/1
|
28
|
+
it "checks show json response" do
|
29
|
+
get "api/1/users/#{@user.id}", nil, @header
|
30
|
+
expect(response.status).to eq(200) #ok
|
31
|
+
expect(json["user"]["id"]).to eq(1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
36
|
+
describe "Update" do
|
37
|
+
before(:example) do
|
38
|
+
@user = FactoryGirl.create(:people_user_1)
|
39
|
+
token = @user.tokens[0].auth_token
|
40
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
41
|
+
@attrs = FactoryGirl.attributes_for(:people_user_1)
|
42
|
+
@attrs["email"] = @user.email
|
43
|
+
@attrs["username"] = @user.username
|
44
|
+
end
|
45
|
+
# put /api/1/users/1
|
46
|
+
it "checks update json response" do
|
47
|
+
@attrs["email"] = "Cole@LaunchU.com"
|
48
|
+
hash = {"user" => @attrs}
|
49
|
+
#This uses users 1 header
|
50
|
+
put "api/1/users/#{@user.id}", hash, @header
|
51
|
+
expect(response.status).to eq(200) #ok
|
52
|
+
expect(json["user"]["email"]).to eq("cole@launchu.com")
|
53
|
+
end
|
54
|
+
it "makes sure a user cannot alter another users information" do
|
55
|
+
FactoryGirl.create(:people_user_1)
|
56
|
+
@attrs["email"] = "Cole@LaunchU.com"
|
57
|
+
hash = {"user" => @attrs}
|
58
|
+
#This uses users 1 header and user 2 id
|
59
|
+
put "api/1/users/#{@user.id + 1}", hash, @header
|
60
|
+
expect(response.status).to eq(403) #forbidden
|
61
|
+
end
|
62
|
+
it "makes sure a user can't update to bad values" do
|
63
|
+
@attrs["email"] = ""
|
64
|
+
hash = {"user" => @attrs}
|
65
|
+
#This uses users 1 header
|
66
|
+
put "api/1/users/#{@user.id}", hash, @header
|
67
|
+
expect(response.status).to eq(422) #ok
|
68
|
+
end
|
69
|
+
# put /api/1/users/1
|
70
|
+
it "makes sure a user can't update without sending the password" do
|
71
|
+
@attrs["password"] = ""
|
72
|
+
hash = {"user" => @attrs}
|
73
|
+
#This uses users 1 header
|
74
|
+
put 'api/1/users/1', hash, @header
|
75
|
+
expect(response.status).to eq(401) #ok
|
76
|
+
end
|
77
|
+
# put /api/1/users/1
|
78
|
+
it "makes sure a user can change their password" do
|
79
|
+
@attrs["email"] = @user.email
|
80
|
+
@attrs["new_password"] = "new"
|
81
|
+
@attrs["new_password_confirmation"] = "new"
|
82
|
+
hash = {"user" => @attrs}
|
83
|
+
#This uses users 1 header
|
84
|
+
put "api/1/users/#{@user.id}", hash, @header
|
85
|
+
expect(response.status).to eq(200) #ok
|
86
|
+
@attrs["password"] = "new"
|
87
|
+
hash = {"user" => @attrs}
|
88
|
+
post "api/1/authentication/authenticate", hash, @header
|
89
|
+
expect(response.status).to eq(200) #ok
|
90
|
+
end
|
91
|
+
# put /api/1/users/1
|
92
|
+
it "makes sure a user account is not confirmed after changing emails" do
|
93
|
+
@user.confirmed = true
|
94
|
+
@user.save
|
95
|
+
expect(@user.confirmed).to eq(true)
|
96
|
+
@attrs["email"] = "Cole@LaunchU.com"
|
97
|
+
hash = {"user" => @attrs}
|
98
|
+
#This uses users 1 header
|
99
|
+
put "api/1/users/#{@user.id}", hash, @header
|
100
|
+
expect(response.status).to eq(200) #ok
|
101
|
+
@user.reload
|
102
|
+
expect(@user.confirmed).to eq(false)
|
103
|
+
expect(json["user"]["email"]).to eq("cole@launchu.com")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
108
|
+
describe "Destroy" do
|
109
|
+
before(:example) do
|
110
|
+
@user = FactoryGirl.create(:people_user_1)
|
111
|
+
token = @user.tokens[0].auth_token
|
112
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
113
|
+
@attrs = FactoryGirl.attributes_for(:people_user_1)
|
114
|
+
@attrs["email"] = @user.email
|
115
|
+
@attrs["username"] = @user.username
|
116
|
+
end
|
117
|
+
# delete /api/1/users/1
|
118
|
+
it "makes sure a user can delete their accout" do
|
119
|
+
hash = {"user" => @attrs}
|
120
|
+
#This uses users 1 header
|
121
|
+
delete "api/1/users/#{@user.id}", hash, @header
|
122
|
+
expect(response.status).to eq(200) #ok
|
123
|
+
expect(::People::V1::User.count).to eq(0)
|
124
|
+
end
|
125
|
+
# delete /api/1/users/1
|
126
|
+
it "makes sure a user can't delete their account with the incorrect password" do
|
127
|
+
@attrs["password"] = "Wrong_password"
|
128
|
+
hash = {"user" => @attrs}
|
129
|
+
#This uses users 1 header
|
130
|
+
delete "api/1/users/#{@user.id}", hash, @header
|
131
|
+
expect(response.status).to eq(401) #ok
|
132
|
+
expect(::People::V1::User.count).to eq(1)
|
133
|
+
end
|
134
|
+
# delete /api/1/users/2
|
135
|
+
it "makes sure a user can't delete another persons account" do
|
136
|
+
@attrs["password"] = "Wrong_password"
|
137
|
+
hash = {"user" => @attrs}
|
138
|
+
#This uses users 1 header
|
139
|
+
user2 = FactoryGirl.create(:people_user_1)
|
140
|
+
delete "api/1/users/#{user2.id}", hash, @header
|
141
|
+
expect(response.status).to eq(403) #ok
|
142
|
+
expect(::People::V1::User.count).to eq(2)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
#-#-#-#-#Serialization#-#-#-#-#
|
147
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
148
|
+
describe "Serialization" do
|
149
|
+
before(:example) do
|
150
|
+
@user = FactoryGirl.create(:people_user_1)
|
151
|
+
token = @user.tokens[0].auth_token
|
152
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
153
|
+
end
|
154
|
+
# get /api/1/users
|
155
|
+
it "checks only appropriate attributes are sent back for index" do
|
156
|
+
FactoryGirl.create_list(:people_user_1, 10)
|
157
|
+
get 'api/1/users', nil, @header
|
158
|
+
expect(response.status).to eq(200) #ok
|
159
|
+
expect(::People::V1::User.count).to eq(11)
|
160
|
+
expect(::Arcadex::Token.count).to eq(11)
|
161
|
+
expect(json["users"][0]["password_digest"]).to eq(nil)
|
162
|
+
expect(json["users"][0]["created_at"]).to_not eq(nil)
|
163
|
+
expect(json["users"][0]["updated_at"]).to_not eq(nil)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
#-#-#-#-#Errors#-#-#-#-#
|
168
|
+
RSpec.describe ::People::V1::User, :type => :request do
|
169
|
+
describe "Authorization" do
|
170
|
+
before(:example) do
|
171
|
+
@user = FactoryGirl.create(:people_user_1)
|
172
|
+
token = @user.tokens[0].auth_token
|
173
|
+
@header = {::Settings.token_header => token, "Email" => @user.email, ::Settings.main_api_header => ::Settings.main_api_key}
|
174
|
+
end
|
175
|
+
it "checks for 404 response" do
|
176
|
+
get "api/1/users/#{@user.id + 10}", nil, @header
|
177
|
+
expect(response.status).to eq(404) #not_found
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
#The standard rest routes for the user controller
|
4
|
+
RSpec.describe "Users controller rest routing", :type => :routing do
|
5
|
+
routes { People::Engine.routes }
|
6
|
+
|
7
|
+
it "routes to index" do
|
8
|
+
expect(:get => "/api/1/users").to route_to(
|
9
|
+
:controller => "people/api/v1/users",
|
10
|
+
:action => "index"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
it "routes to show" do
|
14
|
+
expect(:get => "/api/1/users/1").to route_to(
|
15
|
+
:controller => "people/api/v1/users",
|
16
|
+
:action => "show",
|
17
|
+
:id => "1"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
it "routes create to register" do
|
21
|
+
expect(:post => "/api/1/users").to route_to(
|
22
|
+
:controller => "people/api/v1/authentication",
|
23
|
+
:action => "register"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
it "routes to update" do
|
27
|
+
expect(:put => "/api/1/users/1/").to route_to(
|
28
|
+
:controller => "people/api/v1/users",
|
29
|
+
:action => "update",
|
30
|
+
:id => "1"
|
31
|
+
)
|
32
|
+
end
|
33
|
+
it "routes to update" do
|
34
|
+
expect(:patch => "/api/1/users/1/").to route_to(
|
35
|
+
:controller => "people/api/v1/users",
|
36
|
+
:action => "update",
|
37
|
+
:id => "1"
|
38
|
+
)
|
39
|
+
end
|
40
|
+
it "routes to delete" do
|
41
|
+
expect(:delete => "/api/1/users/1/").to route_to(
|
42
|
+
:controller => "people/api/v1/users",
|
43
|
+
:action => "destroy",
|
44
|
+
:id => "1"
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module People
|
2
|
+
class TestsGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def sprint
|
6
|
+
copy_test_files_over
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def copy_test_files_over
|
12
|
+
template "factory.rb", "spec/factories/people_user_1_factory.rb"
|
13
|
+
template "models.rb", "spec/engines/people/api/v1/models/user_spec.rb"
|
14
|
+
template "requests.rb", "spec/engines/people/api/v1/requests/user_spec.rb"
|
15
|
+
template "routing.rb", "spec/engines/people/api/v1/routing/user_spec.rb"
|
16
|
+
template "authentication_requests.rb", "spec/engines/people/api/v1/requests/authentication_spec.rb"
|
17
|
+
template "authentication_routing.rb", "spec/engines/people/api/v1/routing/authentication_spec.rb"
|
18
|
+
template "email_hash_factory.rb", "spec/factories/people_email_hash_factory.rb"
|
19
|
+
template "email_hash_model.rb", "spec/engines/people/models/email_hash_spec.rb"
|
20
|
+
template "email_hash_request.rb", "spec/engines/people/requests/email_hash_spec.rb"
|
21
|
+
template "account_routing.rb", "spec/engines/people/routing/account_spec.rb"
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/people.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module People
|
4
|
+
class AccountControllerTest < ActionController::TestCase
|
5
|
+
test "should get email_confirm" do
|
6
|
+
get :email_confirm
|
7
|
+
assert_response :success
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should get unlock" do
|
11
|
+
get :unlock
|
12
|
+
assert_response :success
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should get forgotten_password" do
|
16
|
+
get :forgotten_password
|
17
|
+
assert_response :success
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module People
|
4
|
+
class UsersControllerTest < ActionController::TestCase
|
5
|
+
setup do
|
6
|
+
@user = users(:one)
|
7
|
+
end
|
8
|
+
|
9
|
+
test "should get index" do
|
10
|
+
get :index
|
11
|
+
assert_response :success
|
12
|
+
assert_not_nil assigns(:users)
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should get new" do
|
16
|
+
get :new
|
17
|
+
assert_response :success
|
18
|
+
end
|
19
|
+
|
20
|
+
test "should create user" do
|
21
|
+
assert_difference('User.count') do
|
22
|
+
post :create, user: { email: @user.email, password_digest: @user.password_digest, username: @user.username }
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_redirected_to user_path(assigns(:user))
|
26
|
+
end
|
27
|
+
|
28
|
+
test "should show user" do
|
29
|
+
get :show, id: @user
|
30
|
+
assert_response :success
|
31
|
+
end
|
32
|
+
|
33
|
+
test "should get edit" do
|
34
|
+
get :edit, id: @user
|
35
|
+
assert_response :success
|
36
|
+
end
|
37
|
+
|
38
|
+
test "should update user" do
|
39
|
+
patch :update, id: @user, user: { email: @user.email, password_digest: @user.password_digest, username: @user.username }
|
40
|
+
assert_redirected_to user_path(assigns(:user))
|
41
|
+
end
|
42
|
+
|
43
|
+
test "should destroy user" do
|
44
|
+
assert_difference('User.count', -1) do
|
45
|
+
delete :destroy, id: @user
|
46
|
+
end
|
47
|
+
|
48
|
+
assert_redirected_to users_path
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|