rails_apps_pages 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/CHANGELOG.textile +4 -0
- data/README.textile +0 -1
- data/lib/generators/pages/users/users_generator.rb +0 -16
- data/lib/rails_apps_pages/version.rb +1 -1
- metadata +2 -13
- data/lib/generators/pages/users/templates/spec/factories/users.rb +0 -7
- data/lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb +0 -49
- data/lib/generators/pages/users/templates/spec/features/users/sign_out_spec.rb +0 -21
- data/lib/generators/pages/users/templates/spec/features/users/user_delete_spec.rb +0 -32
- data/lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb +0 -41
- data/lib/generators/pages/users/templates/spec/features/users/user_index_spec.rb +0 -25
- data/lib/generators/pages/users/templates/spec/features/users/user_show_spec.rb +0 -39
- data/lib/generators/pages/users/templates/spec/features/visitors/sign_up_spec.rb +0 -61
- data/lib/generators/pages/users/templates/spec/models/user_spec.rb +0 -13
- data/lib/generators/pages/users/templates/spec/support/helpers.rb +0 -3
- data/lib/generators/pages/users/templates/spec/support/helpers/session_helpers.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a59152aa2c474ade2742bbf471e1d7db7cd22aa0
|
4
|
+
data.tar.gz: 57671f13698c915d66146b6b7819e0a96ffa3681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb4c99313753694356250e3fc95c0bbfd763442c2de03417c33153ce6395c7f6454bdcc96d3cf382804a22655a77cb39a54666a9ed9ab524bf78c6aa5d49a2e
|
7
|
+
data.tar.gz: ef1bc29a33bffb1b369343365a36427b727d3853947b616695f202389f92c78f30ea7f8740815de317b9e65142e2c6fbb81659308e1b8eb74a4bbf038259b700
|
data/CHANGELOG.textile
CHANGED
data/README.textile
CHANGED
@@ -44,22 +44,6 @@ module Pages
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def add_devise_tests
|
48
|
-
return unless File.exists?('config/initializers/devise.rb')
|
49
|
-
return unless File.exists?('spec/spec_helper.rb')
|
50
|
-
copy_file 'spec/factories/users.rb', 'spec/factories/users.rb'
|
51
|
-
copy_file 'spec/features/users/sign_in_spec.rb', 'spec/features/users/sign_in_spec.rb'
|
52
|
-
copy_file 'spec/features/users/sign_out_spec.rb', 'spec/features/users/sign_out_spec.rb'
|
53
|
-
copy_file 'spec/features/users/user_delete_spec.rb', 'spec/features/users/user_delete_spec.rb'
|
54
|
-
copy_file 'spec/features/users/user_edit_spec.rb', 'spec/features/users/user_edit_spec.rb'
|
55
|
-
copy_file 'spec/features/users/user_index_spec.rb', 'spec/features/users/user_index_spec.rb'
|
56
|
-
copy_file 'spec/features/users/user_show_spec.rb', 'spec/features/users/user_show_spec.rb'
|
57
|
-
copy_file 'spec/features/visitors/sign_up_spec.rb', 'spec/features/visitors/sign_up_spec.rb'
|
58
|
-
copy_file 'spec/models/user_spec.rb', 'spec/models/user_spec.rb'
|
59
|
-
copy_file 'spec/support/helpers/session_helpers.rb', 'spec/support/helpers/session_helpers.rb'
|
60
|
-
copy_file 'spec/support/helpers.rb', 'spec/support/helpers.rb'
|
61
|
-
end
|
62
|
-
|
63
47
|
end
|
64
48
|
end
|
65
49
|
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.5.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-06-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,17 +70,6 @@ files:
|
|
70
70
|
- lib/generators/pages/users/templates/devise/permitted_parameters.rb
|
71
71
|
- lib/generators/pages/users/templates/devise/users_controller.rb
|
72
72
|
- lib/generators/pages/users/templates/omniauth/users_controller.rb
|
73
|
-
- lib/generators/pages/users/templates/spec/factories/users.rb
|
74
|
-
- lib/generators/pages/users/templates/spec/features/users/sign_in_spec.rb
|
75
|
-
- lib/generators/pages/users/templates/spec/features/users/sign_out_spec.rb
|
76
|
-
- lib/generators/pages/users/templates/spec/features/users/user_delete_spec.rb
|
77
|
-
- lib/generators/pages/users/templates/spec/features/users/user_edit_spec.rb
|
78
|
-
- lib/generators/pages/users/templates/spec/features/users/user_index_spec.rb
|
79
|
-
- lib/generators/pages/users/templates/spec/features/users/user_show_spec.rb
|
80
|
-
- lib/generators/pages/users/templates/spec/features/visitors/sign_up_spec.rb
|
81
|
-
- lib/generators/pages/users/templates/spec/models/user_spec.rb
|
82
|
-
- lib/generators/pages/users/templates/spec/support/helpers.rb
|
83
|
-
- lib/generators/pages/users/templates/spec/support/helpers/session_helpers.rb
|
84
73
|
- lib/generators/pages/users/templates/users/_user.html.erb
|
85
74
|
- lib/generators/pages/users/templates/users/edit.html.erb
|
86
75
|
- lib/generators/pages/users/templates/users/index.html.erb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# Feature: Sign in
|
2
|
-
# As a user
|
3
|
-
# I want to sign in
|
4
|
-
# So I can visit protected areas of the site
|
5
|
-
feature 'Sign in', :devise do
|
6
|
-
|
7
|
-
# Scenario: User cannot sign in if not registered
|
8
|
-
# Given I do not exist as a user
|
9
|
-
# When I sign in with valid credentials
|
10
|
-
# Then I see an invalid credentials message
|
11
|
-
scenario 'user cannot sign in if not registered' do
|
12
|
-
signin('test@example.com', 'please123')
|
13
|
-
expect(page).to have_content 'Invalid email or password.'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Scenario: User can sign in with valid credentials
|
17
|
-
# Given I exist as a user
|
18
|
-
# And I am not signed in
|
19
|
-
# When I sign in with valid credentials
|
20
|
-
# Then I see a success message
|
21
|
-
scenario 'user can sign in with valid credentials' do
|
22
|
-
user = FactoryGirl.create(:user)
|
23
|
-
signin(user.email, user.password)
|
24
|
-
expect(page).to have_content 'Signed in successfully.'
|
25
|
-
end
|
26
|
-
|
27
|
-
# Scenario: User cannot sign in with wrong email
|
28
|
-
# Given I exist as a user
|
29
|
-
# And I am not signed in
|
30
|
-
# When I sign in with a wrong email
|
31
|
-
# Then I see an invalid email message
|
32
|
-
scenario 'user cannot sign in with wrong email' do
|
33
|
-
user = FactoryGirl.create(:user)
|
34
|
-
signin('invalid@email.com', user.password)
|
35
|
-
expect(page).to have_content 'Invalid email or password.'
|
36
|
-
end
|
37
|
-
|
38
|
-
# Scenario: User cannot sign in with wrong password
|
39
|
-
# Given I exist as a user
|
40
|
-
# And I am not signed in
|
41
|
-
# When I sign in with a wrong password
|
42
|
-
# Then I see an invalid password message
|
43
|
-
scenario 'user cannot sign in with wrong password' do
|
44
|
-
user = FactoryGirl.create(:user)
|
45
|
-
signin(user.email, 'invalidpass')
|
46
|
-
expect(page).to have_content 'Invalid email or password.'
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Feature: Sign out
|
2
|
-
# As a user
|
3
|
-
# I want to sign out
|
4
|
-
# So I can protect my account from unauthorized access
|
5
|
-
feature 'Sign out', :devise do
|
6
|
-
|
7
|
-
# Scenario: User signs out successfully
|
8
|
-
# Given I am signed in
|
9
|
-
# When I sign out
|
10
|
-
# Then I see a signed out message
|
11
|
-
scenario 'user signs out successfully' do
|
12
|
-
user = FactoryGirl.create(:user)
|
13
|
-
signin(user.email, user.password)
|
14
|
-
expect(page).to have_content 'Signed in successfully.'
|
15
|
-
click_link 'Sign out'
|
16
|
-
expect(page).to have_content 'Signed out successfully.'
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
include Warden::Test::Helpers
|
2
|
-
Warden.test_mode!
|
3
|
-
|
4
|
-
# Feature: User delete
|
5
|
-
# As a user
|
6
|
-
# I want to delete my user profile
|
7
|
-
# So I can close my account
|
8
|
-
feature 'User delete', :devise, :js do
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
Warden.test_reset!
|
12
|
-
end
|
13
|
-
|
14
|
-
# Scenario: User can delete own account
|
15
|
-
# Given I am signed in
|
16
|
-
# When I delete my account
|
17
|
-
# Then I should see an account deleted message
|
18
|
-
scenario 'user can delete own account' do
|
19
|
-
skip 'skip a slow test'
|
20
|
-
user = FactoryGirl.create(:user)
|
21
|
-
login_as(user, :scope => :user)
|
22
|
-
visit edit_user_registration_path(user)
|
23
|
-
click_button 'Cancel my account'
|
24
|
-
page.driver.browser.switch_to.alert.accept
|
25
|
-
expect(page).to have_content 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
include Warden::Test::Helpers
|
2
|
-
Warden.test_mode!
|
3
|
-
|
4
|
-
# Feature: User edit
|
5
|
-
# As a user
|
6
|
-
# I want to edit my user profile
|
7
|
-
# So I can change my email address
|
8
|
-
feature 'User edit', :devise do
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
Warden.test_reset!
|
12
|
-
end
|
13
|
-
|
14
|
-
# Scenario: User changes email address
|
15
|
-
# Given I am signed in
|
16
|
-
# When I change my email address
|
17
|
-
# Then I see an account updated message
|
18
|
-
scenario 'user changes email address' do
|
19
|
-
user = FactoryGirl.create(:user)
|
20
|
-
login_as(user, :scope => :user)
|
21
|
-
visit edit_user_registration_path(user)
|
22
|
-
fill_in 'Email', :with => 'newemail@example.com'
|
23
|
-
fill_in 'Current password', :with => user.password
|
24
|
-
click_button 'Update'
|
25
|
-
expect(page).to have_content 'You updated your account successfully.'
|
26
|
-
end
|
27
|
-
|
28
|
-
# Scenario: User cannot edit another user's profile
|
29
|
-
# Given I am signed in
|
30
|
-
# When I try to edit another user's profile
|
31
|
-
# Then I see my own 'edit profile' page
|
32
|
-
scenario "user cannot cannot edit another user's profile", :me do
|
33
|
-
me = FactoryGirl.create(:user)
|
34
|
-
other = FactoryGirl.create(:user, email: 'other@example.com')
|
35
|
-
login_as(me, :scope => :user)
|
36
|
-
visit edit_user_registration_path(other)
|
37
|
-
expect(page).to have_content 'Edit User'
|
38
|
-
expect(page).to have_field('Email', with: me.email)
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
include Warden::Test::Helpers
|
2
|
-
Warden.test_mode!
|
3
|
-
|
4
|
-
# Feature: User index page
|
5
|
-
# As a user
|
6
|
-
# I want to see a list of users
|
7
|
-
# So I can see who has registered
|
8
|
-
feature 'User index page', :devise do
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
Warden.test_reset!
|
12
|
-
end
|
13
|
-
|
14
|
-
# Scenario: User listed on index page
|
15
|
-
# Given I am signed in
|
16
|
-
# When I visit the user index page
|
17
|
-
# Then I see my own email address
|
18
|
-
scenario 'user sees own email address' do
|
19
|
-
user = FactoryGirl.create(:user)
|
20
|
-
login_as(user, scope: :user)
|
21
|
-
visit users_path
|
22
|
-
expect(page).to have_content user.email
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
include Warden::Test::Helpers
|
2
|
-
Warden.test_mode!
|
3
|
-
|
4
|
-
# Feature: User profile page
|
5
|
-
# As a user
|
6
|
-
# I want to visit my user profile page
|
7
|
-
# So I can see my personal account data
|
8
|
-
feature 'User profile page', :devise do
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
Warden.test_reset!
|
12
|
-
end
|
13
|
-
|
14
|
-
# Scenario: User sees own profile
|
15
|
-
# Given I am signed in
|
16
|
-
# When I visit the user profile page
|
17
|
-
# Then I see my own email address
|
18
|
-
scenario 'user sees own profile' do
|
19
|
-
user = FactoryGirl.create(:user)
|
20
|
-
login_as(user, :scope => :user)
|
21
|
-
visit user_path(user)
|
22
|
-
expect(page).to have_content 'User'
|
23
|
-
expect(page).to have_content user.email
|
24
|
-
end
|
25
|
-
|
26
|
-
# Scenario: User cannot see another user's profile
|
27
|
-
# Given I am signed in
|
28
|
-
# When I visit another user's profile
|
29
|
-
# Then I see an 'access denied' message
|
30
|
-
scenario "user cannot see another user's profile" do
|
31
|
-
me = FactoryGirl.create(:user)
|
32
|
-
other = FactoryGirl.create(:user, email: 'other@example.com')
|
33
|
-
login_as(me, :scope => :user)
|
34
|
-
Capybara.current_session.driver.header 'Referer', root_path
|
35
|
-
visit user_path(other)
|
36
|
-
expect(page).to have_content 'Access denied.'
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# Feature: Sign up
|
2
|
-
# As a visitor
|
3
|
-
# I want to sign up
|
4
|
-
# So I can visit protected areas of the site
|
5
|
-
feature 'Sign Up', :devise do
|
6
|
-
|
7
|
-
# Scenario: Visitor can sign up with valid email address and password
|
8
|
-
# Given I am not signed in
|
9
|
-
# When I sign up with a valid email address and password
|
10
|
-
# Then I see a successful sign up message
|
11
|
-
scenario 'visitor can sign up with valid email address and password' do
|
12
|
-
sign_up_with('test@example.com', 'please123', 'please123')
|
13
|
-
expect(page).to have_content 'Welcome! You have signed up successfully.'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Scenario: Visitor cannot sign up with invalid email address
|
17
|
-
# Given I am not signed in
|
18
|
-
# When I sign up with an invalid email address
|
19
|
-
# Then I see an invalid email message
|
20
|
-
scenario 'visitor cannot sign up with invalid email address' do
|
21
|
-
sign_up_with('bogus', 'please123', 'please123')
|
22
|
-
expect(page).to have_content 'Email is invalid'
|
23
|
-
end
|
24
|
-
|
25
|
-
# Scenario: Visitor cannot sign up without password
|
26
|
-
# Given I am not signed in
|
27
|
-
# When I sign up without a password
|
28
|
-
# Then I see a missing password message
|
29
|
-
scenario 'visitor cannot sign up without password' do
|
30
|
-
sign_up_with('test@example.com', '', '')
|
31
|
-
expect(page).to have_content "Password can't be blank"
|
32
|
-
end
|
33
|
-
|
34
|
-
# Scenario: Visitor cannot sign up with a short password
|
35
|
-
# Given I am not signed in
|
36
|
-
# When I sign up with a short password
|
37
|
-
# Then I see a 'too short password' message
|
38
|
-
scenario 'visitor cannot sign up with a short password' do
|
39
|
-
sign_up_with('test@example.com', 'please', 'please')
|
40
|
-
expect(page).to have_content "Password is too short"
|
41
|
-
end
|
42
|
-
|
43
|
-
# Scenario: Visitor cannot sign up without password confirmation
|
44
|
-
# Given I am not signed in
|
45
|
-
# When I sign up without a password confirmation
|
46
|
-
# Then I see a missing password confirmation message
|
47
|
-
scenario 'visitor cannot sign up without password confirmation' do
|
48
|
-
sign_up_with('test@example.com', 'please123', '')
|
49
|
-
expect(page).to have_content "Password confirmation doesn't match"
|
50
|
-
end
|
51
|
-
|
52
|
-
# Scenario: Visitor cannot sign up with mismatched password and confirmation
|
53
|
-
# Given I am not signed in
|
54
|
-
# When I sign up with a mismatched password confirmation
|
55
|
-
# Then I should see a mismatched password message
|
56
|
-
scenario 'visitor cannot sign up with mismatched password and confirmation' do
|
57
|
-
sign_up_with('test@example.com', 'please123', 'mismatch')
|
58
|
-
expect(page).to have_content "Password confirmation doesn't match"
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,18 +0,0 @@
|
|
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 signin(email, password)
|
12
|
-
visit new_user_session_path
|
13
|
-
fill_in 'Email', with: email
|
14
|
-
fill_in 'Password', with: password
|
15
|
-
click_button 'Sign in'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|