rails_apps_pages 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.textile +5 -0
- data/README.textile +14 -0
- data/lib/generators/pages/about/about_generator.rb +5 -0
- data/lib/generators/pages/about/templates/about_page_spec.rb +18 -0
- data/lib/generators/pages/authorized/authorized_generator.rb +1 -10
- data/lib/generators/pages/authorized/templates/users_controller.rb +1 -1
- data/lib/generators/pages/home/home_generator.rb +5 -0
- data/lib/generators/pages/home/templates/home_page_spec.rb +18 -0
- data/lib/generators/pages/users/templates/spec/factories/users.rb +7 -0
- data/lib/generators/pages/users/templates/spec/features/users/log_in_spec.rb +51 -0
- data/lib/generators/pages/users/templates/spec/features/users/log_out_spec.rb +23 -0
- data/lib/generators/pages/users/templates/spec/features/users/user_delete_spec.rb +28 -0
- data/lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb +38 -0
- data/lib/generators/pages/users/templates/spec/features/users/user_index_spec.rb +22 -0
- data/lib/generators/pages/users/templates/spec/features/users/user_show_spec.rb +36 -0
- data/lib/generators/pages/users/templates/spec/features/visitors/sign_up_spec.rb +63 -0
- data/lib/generators/pages/users/templates/spec/models/user_spec.rb +15 -0
- data/lib/generators/pages/users/templates/spec/support/helpers/session_helpers.rb +18 -0
- data/lib/generators/pages/users/templates/spec/support/helpers.rb +3 -0
- data/lib/generators/pages/users/templates/users_controller.rb +3 -0
- data/lib/generators/pages/users/users_generator.rb +16 -3
- data/lib/rails_apps_pages/version.rb +1 -1
- metadata +15 -8
- data/lib/generators/pages/authorized/templates/registrations_controller.rb +0 -9
- data/lib/generators/pages/authorized/templates/users/index.html.erb +0 -16
- data/lib/generators/pages/authorized/templates/users/show.html.erb +0 -2
- data/lib/generators/pages/authorized/templates/visitors/index.html.erb +0 -2
- data/lib/generators/pages/authorized/templates/visitors_controller.rb +0 -2
- data/lib/generators/pages/users/templates/visitors_controller.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1872fad570517fd4656e6480aff28e5dd1ac6e86
|
4
|
+
data.tar.gz: 3a871587aeecf17955ff91696dc5540b3a74d619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2a7661ebccd5ca21501a7f03b01a6ac6809e08c55566d963335676e8b2171e3816fb4df9ad0524f0400ed09306d33111b16c69a197c18381b6cc7077511a5af
|
7
|
+
data.tar.gz: 90df045f3780de58e9fb170fd5cff6b951255fb4a83568c193768e0abc249c1ee267e5641d9cb27f729a271896b0512b8448e5d137cdbc8c7f908db4ee06bd69
|
data/CHANGELOG.textile
CHANGED
data/README.textile
CHANGED
@@ -61,6 +61,20 @@ root :to => "visitors#index"
|
|
61
61
|
|
62
62
|
Why a "Visitors" controller? Why not a "Home" controller or "Welcome" controller? Those names are acceptable. But the home page often implements a user story for a persona named "visitor," so a "Visitors" controller is appropriate.
|
63
63
|
|
64
|
+
h2. Generate an "About" Page
|
65
|
+
|
66
|
+
To run the generator and create an "About" page:
|
67
|
+
|
68
|
+
<pre>
|
69
|
+
$ rails generate pages:about
|
70
|
+
</pre>
|
71
|
+
|
72
|
+
The generator will create:
|
73
|
+
|
74
|
+
* app/views/pages/about.html.erb
|
75
|
+
|
76
|
+
You'll need to install the "high_voltage gem":https://github.com/thoughtbot/high_voltage for the "About" page. The high_voltage gem makes it easy to add pages with static content (text that doesn't change), incorporating a site-wide application layout. The high_voltage gem provides the controller and routes needed to display any pages found in the *app/views/pages/* folder.
|
77
|
+
|
64
78
|
h2. Generate User Pages Requiring Authentication
|
65
79
|
|
66
80
|
If you have a User model and authentication with Devise, you might want to add pages to display a list of users or each user's profile, restricted to logged in users.
|
@@ -11,6 +11,11 @@ module Pages
|
|
11
11
|
copy_file 'about.html.erb', 'app/views/pages/about.html.erb'
|
12
12
|
end
|
13
13
|
|
14
|
+
def add_tests
|
15
|
+
return unless File.exists?('spec/spec_helper.rb')
|
16
|
+
copy_file 'about_page_spec.rb', 'spec/features/visitors/about_page_spec.rb'
|
17
|
+
end
|
18
|
+
|
14
19
|
end
|
15
20
|
end
|
16
21
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Feature: 'About' page
|
4
|
+
# As a visitor
|
5
|
+
# I want to visit an 'about' page
|
6
|
+
# So I can learn more about the website
|
7
|
+
feature 'About page' do
|
8
|
+
|
9
|
+
# Scenario: Visit the 'about' page
|
10
|
+
# Given I am a visitor
|
11
|
+
# When I visit the 'about' page
|
12
|
+
# Then I see "About the Website"
|
13
|
+
scenario 'Visit the about page' do
|
14
|
+
visit 'pages/about'
|
15
|
+
expect(page).to have_content 'About the Website'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -10,19 +10,10 @@ module Pages
|
|
10
10
|
def create_page
|
11
11
|
### assumes we are using Devise for authentication
|
12
12
|
### assumes we are using Pundit for authorization
|
13
|
+
generate 'pages:users -f'
|
13
14
|
copy_file 'users/_user.html.erb', 'app/views/users/_user.html.erb'
|
14
|
-
copy_file 'users/index.html.erb', 'app/views/users/index.html.erb'
|
15
|
-
copy_file 'users/show.html.erb', 'app/views/users/show.html.erb'
|
16
15
|
copy_file 'users_controller.rb', 'app/controllers/users_controller.rb'
|
17
16
|
copy_file 'user_policy.rb', 'app/policies/user_policy.rb'
|
18
|
-
route = ' resources :users'
|
19
|
-
inject_into_file 'config/routes.rb', route + "\n", :after => "devise_for :users\n"
|
20
|
-
copy_file 'registrations_controller.rb', 'app/controllers/registrations_controller.rb'
|
21
|
-
gsub_file 'config/routes.rb', /devise_for :users/, 'devise_for :users, :controllers => {:registrations => "registrations"}'
|
22
|
-
copy_file 'visitors/index.html.erb', 'app/views/visitors/index.html.erb'
|
23
|
-
copy_file 'visitors_controller.rb', 'app/controllers/visitors_controller.rb'
|
24
|
-
route = ' root :to => "visitors#index"'
|
25
|
-
inject_into_file 'config/routes.rb', route + "\n", :after => "routes.draw do\n"
|
26
17
|
end
|
27
18
|
|
28
19
|
end
|
@@ -11,7 +11,7 @@ class UsersController < ApplicationController
|
|
11
11
|
@user = User.find(params[:id])
|
12
12
|
unless current_user.admin?
|
13
13
|
unless @user == current_user
|
14
|
-
redirect_to
|
14
|
+
redirect_to :back, :alert => "Access denied."
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -14,6 +14,11 @@ module Pages
|
|
14
14
|
inject_into_file 'config/routes.rb', route + "\n", :after => "routes.draw do\n"
|
15
15
|
end
|
16
16
|
|
17
|
+
def add_tests
|
18
|
+
return unless File.exists?('spec/spec_helper.rb')
|
19
|
+
copy_file 'home_page_spec.rb', 'spec/features/visitors/home_page_spec.rb'
|
20
|
+
end
|
21
|
+
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Feature: Home page
|
4
|
+
# As a visitor
|
5
|
+
# I want to visit a home page
|
6
|
+
# So I can learn more about the website
|
7
|
+
feature 'Home page' do
|
8
|
+
|
9
|
+
# Scenario: Visit the home page
|
10
|
+
# Given I am a visitor
|
11
|
+
# When I visit the home page
|
12
|
+
# Then I see "Welcome"
|
13
|
+
scenario 'visit the home page' do
|
14
|
+
visit root_path
|
15
|
+
expect(page).to have_content 'Welcome'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Feature: Log in
|
4
|
+
# As a user
|
5
|
+
# I want to log in
|
6
|
+
# So I can visit protected areas of the site
|
7
|
+
feature 'Log in' do
|
8
|
+
|
9
|
+
# Scenario: User cannot log in if not registered
|
10
|
+
# Given I do not exist as a user
|
11
|
+
# When I log in with valid credentials
|
12
|
+
# Then I see an invalid login message
|
13
|
+
scenario 'user cannot log in if not registered' do
|
14
|
+
login('test@example.com', 'please123')
|
15
|
+
expect(page).to have_content 'Invalid email or password.'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Scenario: User can log in with valid credentials
|
19
|
+
# Given I exist as a user
|
20
|
+
# And I am not logged in
|
21
|
+
# When I sign in with valid credentials
|
22
|
+
# Then I see a successful login message
|
23
|
+
scenario 'user can log in with valid credentials' do
|
24
|
+
user = FactoryGirl.create(:user)
|
25
|
+
login(user.email, user.password)
|
26
|
+
expect(page).to have_content 'Signed in successfully.'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Scenario: User cannot log in with wrong email
|
30
|
+
# Given I exist as a user
|
31
|
+
# And I am not logged in
|
32
|
+
# When I log in with a wrong email
|
33
|
+
# Then I see an invalid login message
|
34
|
+
scenario 'user cannot log in with wrong email' do
|
35
|
+
user = FactoryGirl.create(:user)
|
36
|
+
login('invalid@email.com', user.password)
|
37
|
+
expect(page).to have_content 'Invalid email or password.'
|
38
|
+
end
|
39
|
+
|
40
|
+
# Scenario: User cannot log in with wrong password
|
41
|
+
# Given I exist as a user
|
42
|
+
# And I am not logged in
|
43
|
+
# When I log in with a wrong password
|
44
|
+
# Then I see an invalid login message
|
45
|
+
scenario 'user cannot log in with wrong password' do
|
46
|
+
user = FactoryGirl.create(:user)
|
47
|
+
login(user.email, 'invalidpass')
|
48
|
+
expect(page).to have_content 'Invalid email or password.'
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Feature: Log out
|
4
|
+
# As a user
|
5
|
+
# I want to log out
|
6
|
+
# So I can protect my account from unauthorized access
|
7
|
+
feature 'Log out' do
|
8
|
+
|
9
|
+
# Scenario: User logs out successfully
|
10
|
+
# Given I am logged in
|
11
|
+
# When I log out
|
12
|
+
# Then I see a logged out message
|
13
|
+
scenario 'user logs out successfully' do
|
14
|
+
user = FactoryGirl.create(:user)
|
15
|
+
login(user.email, user.password)
|
16
|
+
expect(page).to have_content 'Signed in successfully.'
|
17
|
+
click_link 'Logout'
|
18
|
+
expect(page).to have_content 'Signed out successfully.'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Warden::Test::Helpers
|
3
|
+
Warden.test_mode!
|
4
|
+
|
5
|
+
# Feature: User delete
|
6
|
+
# As a user
|
7
|
+
# I want to delete my user profile
|
8
|
+
# So I can close my account
|
9
|
+
feature 'User delete', js: true do
|
10
|
+
|
11
|
+
# Scenario: User can delete own account
|
12
|
+
# Given I am logged in
|
13
|
+
# When I delete my account
|
14
|
+
# Then I should see an account deleted message
|
15
|
+
scenario 'user can delete own account', :slow do
|
16
|
+
user = FactoryGirl.create(:user)
|
17
|
+
login_as(user, :scope => :user)
|
18
|
+
visit edit_user_registration_path(user)
|
19
|
+
click_button 'Cancel my account'
|
20
|
+
page.driver.browser.switch_to.alert.accept
|
21
|
+
expect(page).to have_content 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Warden::Test::Helpers
|
3
|
+
Warden.test_mode!
|
4
|
+
|
5
|
+
# Feature: User edit
|
6
|
+
# As a user
|
7
|
+
# I want to edit my user profile
|
8
|
+
# So I can change my email address
|
9
|
+
feature 'User edit' do
|
10
|
+
|
11
|
+
# Scenario: User changes email address
|
12
|
+
# Given I am logged in
|
13
|
+
# When I change my email address
|
14
|
+
# Then I see an account updated message
|
15
|
+
scenario 'user changes email address' do
|
16
|
+
user = FactoryGirl.create(:user)
|
17
|
+
login_as(user, :scope => :user)
|
18
|
+
visit edit_user_registration_path(user)
|
19
|
+
fill_in 'Email', :with => 'newemail@example.com'
|
20
|
+
fill_in 'Current password', :with => user.password
|
21
|
+
click_button 'Update'
|
22
|
+
expect(page).to have_content 'You updated your account successfully.'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Scenario: User cannot edit another user's profile
|
26
|
+
# Given I am logged in
|
27
|
+
# When I try to edit another user's profile
|
28
|
+
# Then I see my own 'edit profile' page
|
29
|
+
scenario "user cannot cannot edit another user's profile", :me do
|
30
|
+
me = FactoryGirl.create(:user)
|
31
|
+
other = FactoryGirl.create(:user, email: 'other@example.com')
|
32
|
+
login_as(me, :scope => :user)
|
33
|
+
visit edit_user_registration_path(other)
|
34
|
+
expect(page).to have_content 'Edit User'
|
35
|
+
expect(page).to have_field('Email', with: me.email)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Warden::Test::Helpers
|
3
|
+
Warden.test_mode!
|
4
|
+
|
5
|
+
# Feature: User index page
|
6
|
+
# As a user
|
7
|
+
# I want to see a list of users
|
8
|
+
# So I can confirm the site has multiple users
|
9
|
+
feature 'User index page' do
|
10
|
+
|
11
|
+
# Scenario: User listed on index page
|
12
|
+
# Given I am logged in
|
13
|
+
# When I visit the user index page
|
14
|
+
# Then I see my own email address
|
15
|
+
scenario 'user sees own email address' do
|
16
|
+
user = FactoryGirl.create(:user)
|
17
|
+
login_as(user, scope: :user)
|
18
|
+
visit users_path
|
19
|
+
expect(page).to have_content user.email
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include Warden::Test::Helpers
|
3
|
+
Warden.test_mode!
|
4
|
+
|
5
|
+
# Feature: User profile page
|
6
|
+
# As a user
|
7
|
+
# I want to visit my user profile page
|
8
|
+
# So I can see my personal account data
|
9
|
+
feature 'User profile page' do
|
10
|
+
|
11
|
+
# Scenario: User sees own profile
|
12
|
+
# Given I am logged in
|
13
|
+
# When I visit the user profile page
|
14
|
+
# Then I see my own email address
|
15
|
+
scenario 'user sees own profile' do
|
16
|
+
user = FactoryGirl.create(:user)
|
17
|
+
login_as(user, :scope => :user)
|
18
|
+
visit user_path(user)
|
19
|
+
expect(page).to have_content 'User'
|
20
|
+
expect(page).to have_content user.email
|
21
|
+
end
|
22
|
+
|
23
|
+
# Scenario: User cannot see another user's profile
|
24
|
+
# Given I am logged in
|
25
|
+
# When I visit another user's profile
|
26
|
+
# Then I see an 'access denied' message
|
27
|
+
scenario "user cannot see another user's profile" do
|
28
|
+
me = FactoryGirl.create(:user)
|
29
|
+
other = FactoryGirl.create(:user, email: 'other@example.com')
|
30
|
+
login_as(me, :scope => :user)
|
31
|
+
Capybara.current_session.driver.header 'Referer', root_path
|
32
|
+
visit user_path(other)
|
33
|
+
expect(page).to have_content 'Access denied.'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Feature: Sign up
|
4
|
+
# As a visitor
|
5
|
+
# I want to sign up
|
6
|
+
# So I can visit protected areas of the site
|
7
|
+
feature 'Sign Up' do
|
8
|
+
|
9
|
+
# Scenario: Visitor can sign up with valid email address and password
|
10
|
+
# Given I am not logged in
|
11
|
+
# When I sign up with a valid email address and password
|
12
|
+
# Then I see a successful sign up message
|
13
|
+
scenario 'visitor can sign up with valid email address and password' do
|
14
|
+
sign_up_with('test@example.com', 'please123', 'please123')
|
15
|
+
expect(page).to have_content 'Welcome! You have signed up successfully.'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Scenario: Visitor cannot sign up with invalid email address
|
19
|
+
# Given I am not logged in
|
20
|
+
# When I sign up with an invalid email address
|
21
|
+
# Then I see an invalid email message
|
22
|
+
scenario 'visitor cannot sign up with invalid email address' do
|
23
|
+
sign_up_with('bogus', 'please123', 'please123')
|
24
|
+
expect(page).to have_content 'Email is invalid'
|
25
|
+
end
|
26
|
+
|
27
|
+
# Scenario: Visitor cannot sign up without password
|
28
|
+
# Given I am not logged in
|
29
|
+
# When I sign up without a password
|
30
|
+
# Then I see a missing password message
|
31
|
+
scenario 'visitor cannot sign up without password' do
|
32
|
+
sign_up_with('test@example.com', '', '')
|
33
|
+
expect(page).to have_content "Password can't be blank"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Scenario: Visitor cannot sign up with a short password
|
37
|
+
# Given I am not logged in
|
38
|
+
# When I sign up with a short password
|
39
|
+
# Then I see a 'too short password' message
|
40
|
+
scenario 'visitor cannot sign up with a short password' do
|
41
|
+
sign_up_with('test@example.com', 'please', 'please')
|
42
|
+
expect(page).to have_content "Password is too short"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Scenario: Visitor cannot sign up without password confirmation
|
46
|
+
# Given I am not logged in
|
47
|
+
# When I sign up without a password confirmation
|
48
|
+
# Then I see a missing password confirmation message
|
49
|
+
scenario 'visitor cannot sign up without password confirmation' do
|
50
|
+
sign_up_with('test@example.com', 'please123', '')
|
51
|
+
expect(page).to have_content "Password confirmation doesn't match"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Scenario: Visitor cannot sign up with mismatched password and confirmation
|
55
|
+
# Given I am not logged in
|
56
|
+
# When I sign up with a mismatched password confirmation
|
57
|
+
# Then I should see a mismatched password message
|
58
|
+
scenario 'visitor cannot sign up with mismatched password and confirmation' do
|
59
|
+
sign_up_with('test@example.com', 'please123', 'mismatch')
|
60
|
+
expect(page).to have_content "Password confirmation doesn't match"
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
|
5
|
+
before(:each) { @user = User.new(email: 'user@example.com') }
|
6
|
+
|
7
|
+
subject { @user }
|
8
|
+
|
9
|
+
it { should respond_to(:email) }
|
10
|
+
|
11
|
+
it "#email returns a string" do
|
12
|
+
expect(@user.email).to match 'user@example.com'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Features
|
2
|
+
module SessionHelpers
|
3
|
+
def sign_up_with(email, password, confirmation)
|
4
|
+
visit new_user_registration_path
|
5
|
+
fill_in 'Email', with: email
|
6
|
+
fill_in 'Password', with: password
|
7
|
+
fill_in 'Password confirmation', :with => confirmation
|
8
|
+
click_button 'Sign up'
|
9
|
+
end
|
10
|
+
|
11
|
+
def login(email, password)
|
12
|
+
visit new_user_session_path
|
13
|
+
fill_in 'Email', with: email
|
14
|
+
fill_in 'Password', with: password
|
15
|
+
click_button 'Log in'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -17,10 +17,23 @@ module Pages
|
|
17
17
|
inject_into_file 'config/routes.rb', route + "\n", :after => "devise_for :users\n"
|
18
18
|
copy_file 'registrations_controller.rb', 'app/controllers/registrations_controller.rb'
|
19
19
|
gsub_file 'config/routes.rb', /devise_for :users/, 'devise_for :users, :controllers => {:registrations => "registrations"}'
|
20
|
+
generate 'pages:home -f'
|
20
21
|
copy_file 'visitors/index.html.erb', 'app/views/visitors/index.html.erb'
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_tests
|
25
|
+
return unless File.exists?('spec/spec_helper.rb')
|
26
|
+
copy_file 'spec/factories/users.rb', 'spec/factories/users.rb'
|
27
|
+
copy_file 'spec/features/users/log_in_spec.rb', 'spec/features/users/log_in_spec.rb'
|
28
|
+
copy_file 'spec/features/users/log_out_spec.rb', 'spec/features/users/log_out_spec.rb'
|
29
|
+
copy_file 'spec/features/users/user_delete_spec.rb', 'spec/features/users/user_delete_spec.rb'
|
30
|
+
copy_file 'spec/features/users/user_edit_spec.rb', 'spec/features/users/user_edit_spec.rb'
|
31
|
+
copy_file 'spec/features/users/user_index_spec.rb', 'spec/features/users/user_index_spec.rb'
|
32
|
+
copy_file 'spec/features/users/user_show_spec.rb', 'spec/features/users/user_show_spec.rb'
|
33
|
+
copy_file 'spec/features/visitors/sign_up_spec.rb', 'spec/features/visitors/sign_up_spec.rb'
|
34
|
+
copy_file 'spec/models/user_spec.rb', 'spec/models/user_spec.rb'
|
35
|
+
copy_file 'spec/support/helpers/session_helpers.rb', 'spec/support/helpers/session_helpers.rb'
|
36
|
+
copy_file 'spec/support/helpers.rb', 'spec/support/helpers.rb'
|
24
37
|
end
|
25
38
|
|
26
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,25 +58,32 @@ files:
|
|
58
58
|
- lib/generators/clean/routes_generator.rb
|
59
59
|
- lib/generators/pages/about/about_generator.rb
|
60
60
|
- lib/generators/pages/about/templates/about.html.erb
|
61
|
+
- lib/generators/pages/about/templates/about_page_spec.rb
|
61
62
|
- lib/generators/pages/authorized/authorized_generator.rb
|
62
|
-
- lib/generators/pages/authorized/templates/registrations_controller.rb
|
63
63
|
- lib/generators/pages/authorized/templates/user_policy.rb
|
64
64
|
- lib/generators/pages/authorized/templates/users/_user.html.erb
|
65
|
-
- lib/generators/pages/authorized/templates/users/index.html.erb
|
66
|
-
- lib/generators/pages/authorized/templates/users/show.html.erb
|
67
65
|
- lib/generators/pages/authorized/templates/users_controller.rb
|
68
|
-
- lib/generators/pages/authorized/templates/visitors/index.html.erb
|
69
|
-
- lib/generators/pages/authorized/templates/visitors_controller.rb
|
70
66
|
- lib/generators/pages/home/home_generator.rb
|
67
|
+
- lib/generators/pages/home/templates/home_page_spec.rb
|
71
68
|
- lib/generators/pages/home/templates/index.html.erb
|
72
69
|
- lib/generators/pages/home/templates/visitors_controller.rb
|
73
70
|
- lib/generators/pages/users/templates/registrations_controller.rb
|
71
|
+
- lib/generators/pages/users/templates/spec/factories/users.rb
|
72
|
+
- lib/generators/pages/users/templates/spec/features/users/log_in_spec.rb
|
73
|
+
- lib/generators/pages/users/templates/spec/features/users/log_out_spec.rb
|
74
|
+
- lib/generators/pages/users/templates/spec/features/users/user_delete_spec.rb
|
75
|
+
- lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb
|
76
|
+
- lib/generators/pages/users/templates/spec/features/users/user_index_spec.rb
|
77
|
+
- lib/generators/pages/users/templates/spec/features/users/user_show_spec.rb
|
78
|
+
- lib/generators/pages/users/templates/spec/features/visitors/sign_up_spec.rb
|
79
|
+
- lib/generators/pages/users/templates/spec/models/user_spec.rb
|
80
|
+
- lib/generators/pages/users/templates/spec/support/helpers.rb
|
81
|
+
- lib/generators/pages/users/templates/spec/support/helpers/session_helpers.rb
|
74
82
|
- lib/generators/pages/users/templates/users/_user.html.erb
|
75
83
|
- lib/generators/pages/users/templates/users/index.html.erb
|
76
84
|
- lib/generators/pages/users/templates/users/show.html.erb
|
77
85
|
- lib/generators/pages/users/templates/users_controller.rb
|
78
86
|
- lib/generators/pages/users/templates/visitors/index.html.erb
|
79
|
-
- lib/generators/pages/users/templates/visitors_controller.rb
|
80
87
|
- lib/generators/pages/users/users_generator.rb
|
81
88
|
- lib/rails_apps_pages.rb
|
82
89
|
- lib/rails_apps_pages/version.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class RegistrationsController < Devise::RegistrationsController
|
2
|
-
before_filter :update_sanitized_params, if: :devise_controller?
|
3
|
-
|
4
|
-
def update_sanitized_params
|
5
|
-
devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}
|
6
|
-
devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation, :current_password)}
|
7
|
-
end
|
8
|
-
|
9
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<div class="container">
|
2
|
-
<div class="row">
|
3
|
-
<h3>Users</h3>
|
4
|
-
<div class="column">
|
5
|
-
<table class="table">
|
6
|
-
<tbody>
|
7
|
-
<% @users.each do |user| %>
|
8
|
-
<tr>
|
9
|
-
<%= render user %>
|
10
|
-
</tr>
|
11
|
-
<% end %>
|
12
|
-
</tbody>
|
13
|
-
</table>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
</div>
|