raygun 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +11 -0
- data/README.md +14 -9
- data/app_prototype/.rbenv-version +1 -0
- data/app_prototype/Gemfile +6 -0
- data/app_prototype/Guardfile +10 -2
- data/app_prototype/README.md +1 -1
- data/app_prototype/app/controllers/password_resets_controller.rb +6 -8
- data/app_prototype/app/controllers/registrations_controller.rb +1 -1
- data/app_prototype/app/mailers/user_mailer.rb +0 -3
- data/app_prototype/app/models/user.rb +5 -2
- data/app_prototype/app/views/layouts/application.html.slim +1 -1
- data/app_prototype/app/views/password_resets/edit.html.slim +2 -3
- data/app_prototype/app/views/password_resets/new.html.slim +2 -2
- data/app_prototype/app/views/registrations/new.html.slim +1 -2
- data/app_prototype/app/views/user_mailer/activation_needed_email.html.erb +2 -2
- data/app_prototype/app/views/user_mailer/activation_needed_email.text.erb +2 -2
- data/app_prototype/app/views/user_mailer/activation_success_email.html.erb +2 -2
- data/app_prototype/app/views/user_mailer/activation_success_email.text.erb +2 -2
- data/app_prototype/app/views/user_mailer/reset_password_email.html.erb +2 -2
- data/app_prototype/app/views/user_mailer/reset_password_email.text.erb +2 -2
- data/app_prototype/app/views/user_sessions/new.html.slim +2 -2
- data/app_prototype/app/views/users/show.html.slim +1 -1
- data/app_prototype/config/application.rb +2 -2
- data/app_prototype/config/environments/acceptance.rb +1 -1
- data/app_prototype/config/environments/development.rb +1 -1
- data/app_prototype/config/environments/production.rb +1 -1
- data/app_prototype/config/environments/test.rb +2 -0
- data/app_prototype/config/initializers/email.rb +11 -0
- data/app_prototype/config/initializers/secret_token.rb +1 -1
- data/app_prototype/config/routes.rb +10 -10
- data/app_prototype/config.ru +12 -2
- data/app_prototype/db/sample_data.rb +4 -4
- data/app_prototype/lib/templates/rspec/scaffold/controller_spec.rb +21 -21
- data/app_prototype/public/index.html +3 -3
- data/app_prototype/spec/controllers/user_sessions_controller_spec.rb +7 -7
- data/app_prototype/spec/controllers/users_controller_spec.rb +22 -22
- data/app_prototype/spec/factories/users.rb +2 -0
- data/app_prototype/spec/features/activation_spec.rb +18 -0
- data/app_prototype/spec/features/password_reset_spec.rb +41 -0
- data/app_prototype/spec/features/registration_spec.rb +39 -0
- data/app_prototype/spec/features/sign_in_spec.rb +30 -0
- data/app_prototype/spec/mailers/user_mailer_spec.rb +16 -16
- data/app_prototype/spec/models/user_spec.rb +13 -6
- data/app_prototype/spec/spec_helper.rb +8 -12
- data/app_prototype/spec/support/user_sessions_feature_helper.rb +2 -2
- data/app_prototype/spec/views/users/edit.html.slim_spec.rb +0 -1
- data/app_prototype/spec/views/users/index.html.slim_spec.rb +0 -1
- data/app_prototype/spec/views/users/new.html.slim_spec.rb +0 -1
- data/app_prototype/spec/views/users/show.html.slim_spec.rb +2 -3
- data/bin/raygun +8 -1
- data/cleanup.sh +8 -0
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +1 -3
- metadata +13 -21
- data/app_prototype/spec/features/user_sessions_spec.rb +0 -32
- data/app_prototype/spec/helpers/users_helper_spec.rb +0 -15
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>App Prototype</title>
|
5
5
|
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css"/>
|
6
6
|
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
|
7
7
|
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<div class="container">
|
16
16
|
<div class="brand">Project_prototype</div>
|
17
17
|
<ul class="nav pull-right">
|
18
|
-
<li><a href="/sign_in">Sign
|
18
|
+
<li><a href="/sign_in">Sign In</a></li>
|
19
19
|
</ul>
|
20
20
|
</div>
|
21
21
|
</nav>
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<p>Custom generator templates create views that are bootstrap compatible and specs that are factory-aware and follow best practices.</p>
|
30
30
|
<p>This application also includes authentication and an example of authorization (sign in as user@example.com / password).</p>
|
31
31
|
|
32
|
-
<p><a class="btn btn-primary btn-large" href="sign_in">Sign
|
32
|
+
<p><a class="btn btn-primary btn-large" href="sign_in">Sign In</a></p>
|
33
33
|
</div>
|
34
34
|
</div>
|
35
35
|
<div class="push"></div>
|
@@ -2,19 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe UserSessionsController do
|
4
4
|
|
5
|
-
describe "
|
5
|
+
describe "#new" do
|
6
6
|
it "assigns a new user as @user" do
|
7
7
|
get :new
|
8
|
-
assigns(:user_session).
|
8
|
+
expect(assigns(:user_session)).to_not be_nil
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe "
|
12
|
+
describe "#create" do
|
13
13
|
describe "with valid params" do
|
14
14
|
it "redirect to the target page" do
|
15
15
|
subject.stub(:login) { build_stubbed :user }
|
16
16
|
post :create, { user_session: { email: 'valid', password: 'valid' } }, { return_to_url: 'url' }
|
17
|
-
response.
|
17
|
+
expect(response).to redirect_to('url')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,12 +22,12 @@ describe UserSessionsController do
|
|
22
22
|
it "re-renders the 'new' template" do
|
23
23
|
subject.stub(:login) { nil }
|
24
24
|
post :create, { user_session: { email: 'invalid', password: 'invalid' } }
|
25
|
-
response.
|
25
|
+
expect(response).to render_template('new')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe "
|
30
|
+
describe "#destroy" do
|
31
31
|
it "destroys the requested user session" do
|
32
32
|
subject.should_receive(:logout)
|
33
33
|
delete :destroy
|
@@ -35,7 +35,7 @@ describe UserSessionsController do
|
|
35
35
|
|
36
36
|
it "redirects to the sign in page" do
|
37
37
|
delete :destroy
|
38
|
-
response.
|
38
|
+
expect(response).to redirect_to(sign_in_url)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -9,7 +9,7 @@ describe UsersController do
|
|
9
9
|
attributes_for :user
|
10
10
|
end
|
11
11
|
|
12
|
-
# This
|
12
|
+
# This returns the minimal set of values that should be in the session
|
13
13
|
# in order to pass any filters (e.g. authentication) defined in
|
14
14
|
# UsersController. Be sure to keep this updated too.
|
15
15
|
def valid_session
|
@@ -20,38 +20,38 @@ describe UsersController do
|
|
20
20
|
login_user build :admin
|
21
21
|
end
|
22
22
|
|
23
|
-
describe "
|
23
|
+
describe "#index" do
|
24
24
|
it "assigns all users as @users" do
|
25
25
|
user = User.create! valid_attributes
|
26
26
|
get :index, {}, valid_session
|
27
|
-
assigns(:users).
|
27
|
+
expect(assigns(:users)).to eq([user])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "
|
31
|
+
describe "#show" do
|
32
32
|
it "assigns the requested user as @user" do
|
33
33
|
user = User.create! valid_attributes
|
34
34
|
get :show, { id: user.to_param }, valid_session
|
35
|
-
assigns(:user).
|
35
|
+
expect(assigns(:user)).to eq(user)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe "
|
39
|
+
describe "#new" do
|
40
40
|
it "assigns a new user as @user" do
|
41
41
|
get :new, {}, valid_session
|
42
|
-
assigns(:user).
|
42
|
+
expect(assigns(:user)).to be_a_new(User)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "
|
46
|
+
describe "#edit" do
|
47
47
|
it "assigns the requested user as @user" do
|
48
48
|
user = User.create! valid_attributes
|
49
49
|
get :edit, { id: user.to_param }, valid_session
|
50
|
-
assigns(:user).
|
50
|
+
expect(assigns(:user)).to eq(user)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
describe "
|
54
|
+
describe "#create" do
|
55
55
|
describe "with valid params" do
|
56
56
|
it "creates a new User" do
|
57
57
|
expect {
|
@@ -61,13 +61,13 @@ describe UsersController do
|
|
61
61
|
|
62
62
|
it "assigns a newly created user as @user" do
|
63
63
|
post :create, {user: valid_attributes }, valid_session
|
64
|
-
assigns(:user).
|
65
|
-
assigns(:user).
|
64
|
+
expect(assigns(:user)).to be_a(User)
|
65
|
+
expect(assigns(:user)).to be_persisted
|
66
66
|
end
|
67
67
|
|
68
68
|
it "redirects to the created user" do
|
69
69
|
post :create, { user: valid_attributes }, valid_session
|
70
|
-
response.
|
70
|
+
expect(response).to redirect_to(User.last)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,19 +76,19 @@ describe UsersController do
|
|
76
76
|
# Trigger the behavior that occurs when invalid params are submitted
|
77
77
|
User.any_instance.stub(:save).and_return(false)
|
78
78
|
post :create, { user: { "email" => "invalid value" } }, valid_session
|
79
|
-
assigns(:user).
|
79
|
+
expect(assigns(:user)).to be_a_new(User)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "re-renders the 'new' template" do
|
83
83
|
# Trigger the behavior that occurs when invalid params are submitted
|
84
84
|
User.any_instance.stub(:save).and_return(false)
|
85
85
|
post :create, { user: { "email" => "invalid value" } }, valid_session
|
86
|
-
response.
|
86
|
+
expect(response).to render_template("new")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
describe "
|
91
|
+
describe "#update" do
|
92
92
|
describe "with valid params" do
|
93
93
|
it "updates the requested user" do
|
94
94
|
user = User.create! valid_attributes
|
@@ -103,13 +103,13 @@ describe UsersController do
|
|
103
103
|
it "assigns the requested user as @user" do
|
104
104
|
user = User.create! valid_attributes
|
105
105
|
put :update, { id: user.to_param, user: valid_attributes }, valid_session
|
106
|
-
assigns(:user).
|
106
|
+
expect(assigns(:user)).to eq(user)
|
107
107
|
end
|
108
108
|
|
109
109
|
it "redirects to the user" do
|
110
110
|
user = User.create! valid_attributes
|
111
111
|
put :update, { id: user.to_param, user: valid_attributes }, valid_session
|
112
|
-
response.
|
112
|
+
expect(response).to redirect_to(user)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -119,7 +119,7 @@ describe UsersController do
|
|
119
119
|
# Trigger the behavior that occurs when invalid params are submitted
|
120
120
|
User.any_instance.stub(:save).and_return(false)
|
121
121
|
put :update, { id: user.to_param, user: { "email" => "invalid value" } }, valid_session
|
122
|
-
assigns(:user).
|
122
|
+
expect(assigns(:user)).to eq(user)
|
123
123
|
end
|
124
124
|
|
125
125
|
it "re-renders the 'edit' template" do
|
@@ -127,12 +127,12 @@ describe UsersController do
|
|
127
127
|
# Trigger the behavior that occurs when invalid params are submitted
|
128
128
|
User.any_instance.stub(:save).and_return(false)
|
129
129
|
put :update, { id: user.to_param, user: { "email" => "invalid value" } }, valid_session
|
130
|
-
response.
|
130
|
+
expect(response).to render_template("edit")
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
describe "
|
135
|
+
describe "#destroy" do
|
136
136
|
it "destroys the requested user" do
|
137
137
|
user = User.create! valid_attributes
|
138
138
|
expect {
|
@@ -143,7 +143,7 @@ describe UsersController do
|
|
143
143
|
it "redirects to the users list" do
|
144
144
|
user = User.create! valid_attributes
|
145
145
|
delete :destroy, { id: user.to_param }, valid_session
|
146
|
-
response.
|
146
|
+
expect(response).to redirect_to(users_url)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature "Activation" do
|
4
|
+
scenario "with a valid token should activate the user and sign them in" do
|
5
|
+
@user = create(:user)
|
6
|
+
visit activation_path(@user.activation_token)
|
7
|
+
|
8
|
+
expect(current_path).to eq sign_in_path
|
9
|
+
expect(page).to have_content "Your account has been activated and you're now signed in."
|
10
|
+
end
|
11
|
+
|
12
|
+
scenario "with an invalid token should send the user to sign in" do
|
13
|
+
visit activation_path('BOGUS')
|
14
|
+
|
15
|
+
expect(current_path).to eq sign_in_path
|
16
|
+
expect(page).to have_content "Please sign in first."
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature "Password Reset" do
|
4
|
+
background do
|
5
|
+
clear_emails
|
6
|
+
@user = create(:user)
|
7
|
+
@user.activate!
|
8
|
+
|
9
|
+
visit sign_in_path
|
10
|
+
click_link 'Reset Password'
|
11
|
+
|
12
|
+
fill_in 'Email', with: @user.email
|
13
|
+
click_button 'Reset My Password'
|
14
|
+
|
15
|
+
@user.reload
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
@user.destroy
|
20
|
+
end
|
21
|
+
|
22
|
+
scenario "displays a message about the password reset email" do
|
23
|
+
expect(page).to have_content "Password reset instructions have been sent to your email."
|
24
|
+
expect(current_path).to eq sign_in_path
|
25
|
+
end
|
26
|
+
|
27
|
+
scenario "sends a password reset email with url" do
|
28
|
+
expect(open_email(@user.email)).to_not be_nil
|
29
|
+
expect(current_email).to have_content reset_password_path(@user.reset_password_token)
|
30
|
+
end
|
31
|
+
|
32
|
+
scenario "resets the password" do
|
33
|
+
visit reset_password_path(@user.reset_password_token)
|
34
|
+
|
35
|
+
fill_in 'New Password', with: 'som3_g00d_p@ssword'
|
36
|
+
click_button 'Reset Password'
|
37
|
+
|
38
|
+
expect(page).to have_content "Password was successfully updated."
|
39
|
+
expect(current_path).to eq sign_in_path
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# http://www.elabs.se/blog/51-simple-tricks-to-clean-up-your-capybara-tests
|
4
|
+
|
5
|
+
feature "Registration" do
|
6
|
+
background do
|
7
|
+
clear_emails
|
8
|
+
|
9
|
+
@email = 'stan@example.com'
|
10
|
+
|
11
|
+
visit sign_up_path
|
12
|
+
|
13
|
+
within '#new_user' do
|
14
|
+
fill_in 'Email', with: @email
|
15
|
+
fill_in 'Name', with: 'Stan'
|
16
|
+
fill_in 'Password', with: 'p@ssword'
|
17
|
+
click_button 'Sign Up'
|
18
|
+
end
|
19
|
+
|
20
|
+
@user = User.find_by_email(@email)
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
@user.destroy
|
25
|
+
end
|
26
|
+
|
27
|
+
it "creates a new user" do
|
28
|
+
expect(@user).to_not be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it "displays a message about activation" do
|
32
|
+
expect(find('.alert')).to have_content "Thanks for signing up. Please check your email for activation instructions."
|
33
|
+
end
|
34
|
+
|
35
|
+
it "sends the activation email with url" do
|
36
|
+
expect(open_email(@email)).to_not be_nil
|
37
|
+
expect(current_email).to have_content activation_path(@user.activation_token)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature "Sign In" do
|
4
|
+
background(:all) do
|
5
|
+
@user = create(:user)
|
6
|
+
@user.activate!
|
7
|
+
end
|
8
|
+
|
9
|
+
after(:all) do
|
10
|
+
@user.destroy
|
11
|
+
end
|
12
|
+
|
13
|
+
scenario "authenticates with valid credentials" do
|
14
|
+
sign_in(@user.email, 'password')
|
15
|
+
|
16
|
+
expect(find('.alert')).to have_content("Successfully signed in")
|
17
|
+
end
|
18
|
+
|
19
|
+
scenario "displays a generic error message with an invalid email" do
|
20
|
+
sign_in('this is not valid', 'password')
|
21
|
+
|
22
|
+
expect(find('.alert')).to have_content("Sign in failed")
|
23
|
+
end
|
24
|
+
|
25
|
+
scenario "displays a generic error message with an invalid password" do
|
26
|
+
sign_in(@user.email, 'this is not valid')
|
27
|
+
|
28
|
+
expect(find('.alert')).to have_content("Sign in failed")
|
29
|
+
end
|
30
|
+
end
|
@@ -1,47 +1,47 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe UserMailer do
|
4
|
-
let(:user) { build_stubbed(:user) }
|
4
|
+
let(:user) { build_stubbed(:user, activation_state: 'pending', activation_token: 'ABC', reset_password_token: 'XYZ') }
|
5
5
|
|
6
|
-
describe "activation_needed_email" do
|
6
|
+
describe "#activation_needed_email" do
|
7
7
|
let(:mail) { UserMailer.activation_needed_email(user) }
|
8
8
|
|
9
9
|
it "renders the headers" do
|
10
|
-
mail.subject.
|
11
|
-
mail.to.
|
12
|
-
mail.from.
|
10
|
+
expect(mail.subject).to eq "Welcome to My Awesome Site!"
|
11
|
+
expect(mail.to).to eq [user.email]
|
12
|
+
expect(mail.from).to eq %w(notifications@example.com)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "renders the body" do
|
16
|
-
mail.body.encoded.
|
16
|
+
expect(mail.body.encoded).to match "Welcome to"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe "activation_success_email" do
|
20
|
+
describe "#activation_success_email" do
|
21
21
|
let(:mail) { UserMailer.activation_success_email(user) }
|
22
22
|
|
23
23
|
it "renders the headers" do
|
24
|
-
mail.subject.
|
25
|
-
mail.to.
|
26
|
-
mail.from.
|
24
|
+
expect(mail.subject).to eq "Your account has been activated!"
|
25
|
+
expect(mail.to).to eq [user.email]
|
26
|
+
expect(mail.from).to eq %w(notifications@example.com)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "renders the body" do
|
30
|
-
mail.body.encoded.
|
30
|
+
expect(mail.body.encoded).to match "You have successfully activated"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe "reset_password_email" do
|
34
|
+
describe "#reset_password_email" do
|
35
35
|
let(:mail) { UserMailer.reset_password_email(user) }
|
36
36
|
|
37
37
|
it "renders the headers" do
|
38
|
-
mail.subject.
|
39
|
-
mail.to.
|
40
|
-
mail.from.
|
38
|
+
expect(mail.subject).to eq "Password reset requested"
|
39
|
+
expect(mail.to).to eq [user.email]
|
40
|
+
expect(mail.from).to eq %w(notifications@example.com)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "renders the body" do
|
44
|
-
mail.body.encoded.
|
44
|
+
expect(mail.body.encoded).to match "You have requested to reset your password."
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -7,23 +7,30 @@ describe User do
|
|
7
7
|
|
8
8
|
describe "name" do
|
9
9
|
it "is required" do
|
10
|
-
subject.
|
10
|
+
expect(subject).to_not accept_values(:email, nil, '')
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should be less than 30 characters"
|
13
|
+
it "should be less than 30 characters" do
|
14
|
+
expect(subject).to accept_values(:name, 'a' * 30)
|
15
|
+
expect(subject).to_not accept_values(:name, 'a' * 31)
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
19
|
describe "email" do
|
17
20
|
it "is required" do
|
18
|
-
subject.
|
21
|
+
expect(subject).to_not accept_values(:email, nil, '', ' ')
|
19
22
|
end
|
20
23
|
|
21
24
|
it "must be properly formatted" do
|
22
|
-
subject.
|
23
|
-
subject.
|
25
|
+
expect(subject).to accept_values(:email, 'a@b.com', 'a@b.c.com')
|
26
|
+
expect(subject).to_not accept_values(:email, 'a@b', 'a.b.com')
|
24
27
|
end
|
25
28
|
|
26
|
-
it "must be unique"
|
29
|
+
it "must be unique" do
|
30
|
+
subject.save
|
31
|
+
stunt_double = subject.dup
|
32
|
+
expect(stunt_double).to_not accept_values(:email, subject.email)
|
33
|
+
end
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
@@ -25,25 +25,17 @@ if ENV['COVERAGE']
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
require File.expand_path("../../config/environment", __FILE__)
|
28
|
+
ENV['RAILS_ENV'] ||= 'test'
|
29
|
+
require File.expand_path('../../config/environment', __FILE__)
|
31
30
|
require 'rspec/rails'
|
32
31
|
require 'rspec/autorun'
|
32
|
+
require 'capybara/email/rspec'
|
33
33
|
|
34
34
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
35
35
|
# in spec/support/ and its subdirectories.
|
36
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
36
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
37
37
|
|
38
38
|
RSpec.configure do |config|
|
39
|
-
# ## Mock Framework
|
40
|
-
#
|
41
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
42
|
-
#
|
43
|
-
# config.mock_with :mocha
|
44
|
-
# config.mock_with :flexmock
|
45
|
-
# config.mock_with :rr
|
46
|
-
|
47
39
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
48
40
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
49
41
|
|
@@ -57,6 +49,10 @@ RSpec.configure do |config|
|
|
57
49
|
# rspec-rails.
|
58
50
|
config.infer_base_class_for_anonymous_controllers = false
|
59
51
|
|
52
|
+
config.expect_with :rspec do |c|
|
53
|
+
c.syntax = :expect
|
54
|
+
end
|
55
|
+
|
60
56
|
# Run specs in random order to surface order dependencies. If you find an
|
61
57
|
# order dependency and want to debug it, you can fix the order by providing
|
62
58
|
# the seed, which is printed after each run.
|
@@ -11,7 +11,6 @@ describe "users/edit" do
|
|
11
11
|
it "renders the edit user form" do
|
12
12
|
render
|
13
13
|
|
14
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
14
|
assert_select "form", action: users_path(@user), method: "post" do
|
16
15
|
assert_select "input#user_email", name: "user[email]"
|
17
16
|
assert_select "input#user_name", name: "user[name]"
|
@@ -16,7 +16,6 @@ describe "users/index" do
|
|
16
16
|
|
17
17
|
it "renders a list of users" do
|
18
18
|
render
|
19
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
20
19
|
assert_select "tr>td", text: "Email".to_s, count: 2
|
21
20
|
assert_select "tr>td", text: "Name".to_s, count: 2
|
22
21
|
end
|
@@ -11,7 +11,6 @@ describe "users/new" do
|
|
11
11
|
it "renders new user form" do
|
12
12
|
render
|
13
13
|
|
14
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
14
|
assert_select "form", action: users_path, method: "post" do
|
16
15
|
assert_select "input#user_email", name: "user[email]"
|
17
16
|
assert_select "input#user_name", name: "user[name]"
|
@@ -10,8 +10,7 @@ describe "users/show" do
|
|
10
10
|
|
11
11
|
it "renders attributes in <p>" do
|
12
12
|
render
|
13
|
-
|
14
|
-
rendered.
|
15
|
-
rendered.should match(/Name/)
|
13
|
+
expect(rendered).to match /Email/
|
14
|
+
expect(rendered).to match /Name/
|
16
15
|
end
|
17
16
|
end
|
data/bin/raygun
CHANGED
@@ -13,6 +13,12 @@ def titleize(underscored_string)
|
|
13
13
|
result.gsub(/\b('?[a-z])/) { $1.capitalize }
|
14
14
|
end
|
15
15
|
|
16
|
+
if !ARGV[0]
|
17
|
+
puts "Please specify where raygun should generate a project (e.g. projects/my_new_project)."
|
18
|
+
puts "usage: raygun new_app_directory"
|
19
|
+
exit 1
|
20
|
+
end
|
21
|
+
|
16
22
|
app_dir = ARGV[0]
|
17
23
|
app_name_snake = File.basename(app_dir)
|
18
24
|
app_name_camel = camelize(app_name_snake)
|
@@ -28,12 +34,13 @@ Dir.chdir(app_dir) do
|
|
28
34
|
`find . -type f -print | xargs sed -i '' 's/AppPrototype/#{app_name_camel}/g'`
|
29
35
|
`find . -type f -print | xargs sed -i '' 's/app_prototype/#{app_name_snake}/g'`
|
30
36
|
`sed -i '' 's/App Prototype/#{app_name_title}/' app/views/layouts/application.html.slim`
|
31
|
-
`sed -i '' 's/
|
37
|
+
`sed -i '' 's/SUPER_SECRET_TOKEN_REPLACE_ME_TODO/#{SecureRandom.hex(128)}/' config/initializers/secret_token.rb`
|
32
38
|
|
33
39
|
puts "Done! Next steps..."
|
34
40
|
puts ""
|
35
41
|
puts "# Install updated dependencies"
|
36
42
|
puts "$ cd #{ARGV[0]}"
|
43
|
+
puts "$ gem install bundler"
|
37
44
|
puts "$ bundle update"
|
38
45
|
puts ""
|
39
46
|
puts "# Prepare the database: schema and reference / sample data"
|
data/cleanup.sh
ADDED
data/lib/raygun/version.rb
CHANGED
data/raygun.gemspec
CHANGED
@@ -7,7 +7,7 @@ require 'raygun/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = "raygun"
|
9
9
|
gem.version = Raygun::VERSION
|
10
|
-
gem.authors = ["Christian Nelson"]
|
10
|
+
gem.authors = ["Christian Nelson", "Jonah Williams", "Jason Wadsworth"]
|
11
11
|
gem.email = ["christian@carbonfive.com"]
|
12
12
|
gem.description = %q{Carbon Five Rails application generator}
|
13
13
|
gem.summary = %q{Generates and customizes Rails applications with Carbon Five best practices baked in.}
|
@@ -17,6 +17,4 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.add_dependency 'bundler', '>= 1.2'
|
22
20
|
end
|