-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f8591c
commit 7de8084
Showing
5 changed files
with
33 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ gem 'rails', '4.2.6' | |
gem 'rails-api' | ||
|
||
gem 'spring', :group => :development | ||
gem 'bcrypt' | ||
|
||
|
||
gem 'sqlite3' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class User < ActiveRecord::Base | ||
has_secure_password | ||
|
||
validates :name, presence: true | ||
validates :email, presence: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
password_digest: MyString | ||
name: MyString | ||
email: MyString | ||
|
||
two: | ||
password_digest: MyString | ||
name: MyString | ||
email: MyString | ||
valid: | ||
password_digest: hotdog | ||
name: Lester Test | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
require 'test_helper' | ||
|
||
class UserTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
setup do | ||
@valid_user = users(:valid) | ||
end | ||
|
||
test "User has correct attributes" do | ||
assert @valid_user.respond_to?(:name) | ||
assert @valid_user.respond_to?(:password_digest) | ||
assert @valid_user.respond_to?(:email) | ||
end | ||
|
||
test "invalid without name" do | ||
@valid_user.name = nil | ||
assert_not @valid_user.valid? | ||
end | ||
|
||
test "invalid without password and password_confirmation" do | ||
end | ||
|
||
test "invalid without email" do | ||
@valid_user.email= nil | ||
assert_not @valid_user.valid? | ||
end | ||
end |