Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
1214b270
Commit
1214b270
authored
Nov 02, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix old spec syntax
parent
34e6e5cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
spec/controllers/users_controller_spec.rb
+2
-2
spec/models/user_spec.rb
+12
-12
spec/rails_helper.rb
+1
-1
No files found.
spec/controllers/users_controller_spec.rb
View file @
1214b270
...
@@ -7,7 +7,7 @@ describe UsersController, type: :controller do
...
@@ -7,7 +7,7 @@ describe UsersController, type: :controller do
sign_in
FactoryGirl
.
create
(
:alice
)
sign_in
FactoryGirl
.
create
(
:alice
)
get
:edit
get
:edit
response
.
should
be_success
expect
(
response
).
to
be_success
end
end
end
end
...
@@ -16,7 +16,7 @@ describe UsersController, type: :controller do
...
@@ -16,7 +16,7 @@ describe UsersController, type: :controller do
sign_in
FactoryGirl
.
create
(
:alice
)
sign_in
FactoryGirl
.
create
(
:alice
)
patch
:update
,
user:
{
nickname:
'bob'
}
patch
:update
,
user:
{
nickname:
'bob'
}
response
.
should
redirect_to
(
'/user/edit'
)
expect
(
response
).
to
redirect_to
(
'/user/edit'
)
end
end
end
end
...
...
spec/models/user_spec.rb
View file @
1214b270
...
@@ -84,14 +84,14 @@ describe User do
...
@@ -84,14 +84,14 @@ describe User do
it
'should require an email address'
do
it
'should require an email address'
do
no_email_user
=
User
.
new
(
@attr
.
merge
(
email:
''
))
no_email_user
=
User
.
new
(
@attr
.
merge
(
email:
''
))
no_email_user
.
should_not
be_valid
expect
(
no_email_user
).
not_to
be_valid
end
end
it
'should accept valid email addresses'
do
it
'should accept valid email addresses'
do
addresses
=
%w(user@foo.com THE_USER@foo.bar.org first.last@foo.jp)
addresses
=
%w(user@foo.com THE_USER@foo.bar.org first.last@foo.jp)
addresses
.
each
do
|
address
|
addresses
.
each
do
|
address
|
valid_email_user
=
User
.
new
(
@attr
.
merge
(
email:
address
))
valid_email_user
=
User
.
new
(
@attr
.
merge
(
email:
address
))
valid_email_user
.
should
be_valid
expect
(
valid_email_user
).
to
be_valid
end
end
end
end
...
@@ -99,21 +99,21 @@ describe User do
...
@@ -99,21 +99,21 @@ describe User do
addresses
=
%w(user@foo,com user_at_foo.org example.user@foo.)
addresses
=
%w(user@foo,com user_at_foo.org example.user@foo.)
addresses
.
each
do
|
address
|
addresses
.
each
do
|
address
|
invalid_email_user
=
User
.
new
(
@attr
.
merge
(
email:
address
))
invalid_email_user
=
User
.
new
(
@attr
.
merge
(
email:
address
))
invalid_email_user
.
should_not
be_valid
expect
(
invalid_email_user
).
not_to
be_valid
end
end
end
end
it
'should reject duplicate email addresses'
do
it
'should reject duplicate email addresses'
do
User
.
create!
(
@attr
)
User
.
create!
(
@attr
)
user_with_duplicate_email
=
User
.
new
(
@attr
)
user_with_duplicate_email
=
User
.
new
(
@attr
)
user_with_duplicate_email
.
should_not
be_valid
expect
(
user_with_duplicate_email
).
not_to
be_valid
end
end
it
'should reject email addresses identical up to case'
do
it
'should reject email addresses identical up to case'
do
upcased_email
=
@attr
[
:email
].
upcase
upcased_email
=
@attr
[
:email
].
upcase
User
.
create!
(
@attr
.
merge
(
email:
upcased_email
))
User
.
create!
(
@attr
.
merge
(
email:
upcased_email
))
user_with_duplicate_email
=
User
.
new
(
@attr
)
user_with_duplicate_email
=
User
.
new
(
@attr
)
user_with_duplicate_email
.
should_not
be_valid
expect
(
user_with_duplicate_email
).
not_to
be_valid
end
end
describe
'passwords'
do
describe
'passwords'
do
...
@@ -123,28 +123,28 @@ describe User do
...
@@ -123,28 +123,28 @@ describe User do
end
end
it
'should have a password attribute'
do
it
'should have a password attribute'
do
@user
.
should
respond_to
(
:password
)
expect
(
@user
).
to
respond_to
(
:password
)
end
end
it
'should have a password confirmation attribute'
do
it
'should have a password confirmation attribute'
do
@user
.
should
respond_to
(
:password_confirmation
)
expect
(
@user
).
to
respond_to
(
:password_confirmation
)
end
end
end
end
describe
'password validations'
do
describe
'password validations'
do
it
'should require a password'
do
it
'should require a password'
do
User
.
new
(
@attr
.
merge
(
password:
''
,
password_confirmation:
''
)).
should_not
be_valid
expect
(
User
.
new
(
@attr
.
merge
(
password:
''
,
password_confirmation:
''
))).
not_to
be_valid
end
end
it
'should require a matching password confirmation'
do
it
'should require a matching password confirmation'
do
User
.
new
(
@attr
.
merge
(
password_confirmation:
'invalid'
)).
should_not
be_valid
expect
(
User
.
new
(
@attr
.
merge
(
password_confirmation:
'invalid'
))).
not_to
be_valid
end
end
it
'should reject short passwords'
do
it
'should reject short passwords'
do
short
=
'a'
*
5
short
=
'a'
*
5
hash
=
@attr
.
merge
(
password:
short
,
password_confirmation:
short
)
hash
=
@attr
.
merge
(
password:
short
,
password_confirmation:
short
)
User
.
new
(
hash
).
should_not
be_valid
expect
(
User
.
new
(
hash
)).
not_to
be_valid
end
end
end
end
...
@@ -156,11 +156,11 @@ describe User do
...
@@ -156,11 +156,11 @@ describe User do
end
end
it
'should have an encrypted password attribute'
do
it
'should have an encrypted password attribute'
do
@user
.
should
respond_to
(
:encrypted_password
)
expect
(
@user
).
to
respond_to
(
:encrypted_password
)
end
end
it
'should set the encrypted password attribute'
do
it
'should set the encrypted password attribute'
do
@user
.
encrypted_password
.
should_not
be_blank
expect
(
@user
.
encrypted_password
).
not_to
be_blank
end
end
end
end
...
...
spec/rails_helper.rb
View file @
1214b270
...
@@ -9,7 +9,7 @@ require File.expand_path('../../config/environment', __FILE__)
...
@@ -9,7 +9,7 @@ require File.expand_path('../../config/environment', __FILE__)
Dir
[
'./spec/support/**/*.rb'
].
sort
.
each
{
|
f
|
require
f
}
Dir
[
'./spec/support/**/*.rb'
].
sort
.
each
{
|
f
|
require
f
}
require
'rspec/rails'
require
'rspec/rails'
require
'rspec/autorun'
#
require 'rspec/autorun'
# require 'email_spec'
# require 'email_spec'
require
'factory_girl'
require
'factory_girl'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment