@@ -128,9 +128,21 class UserTest < ActiveSupport::TestCase | |||||
128 | end |
|
128 | end | |
129 |
|
129 | |||
130 | context "with a successful authentication" do |
|
130 | context "with a successful authentication" do | |
131 | should "create a new user account" do |
|
131 | should "create a new user account if it doesn't exist" do | |
132 | assert_difference('User.count') do |
|
132 | assert_difference('User.count') do | |
133 | User.try_to_login('edavis', '123456') |
|
133 | user = User.try_to_login('edavis', '123456') | |
|
134 | assert !user.admin? | |||
|
135 | end | |||
|
136 | end | |||
|
137 | ||||
|
138 | should "retrieve existing user" do | |||
|
139 | user = User.try_to_login('edavis', '123456') | |||
|
140 | user.admin = true | |||
|
141 | user.save! | |||
|
142 | ||||
|
143 | assert_no_difference('User.count') do | |||
|
144 | user = User.try_to_login('edavis', '123456') | |||
|
145 | assert user.admin? | |||
134 | end |
|
146 | end | |
135 | end |
|
147 | end | |
136 | end |
|
148 | end |
General Comments 0
You need to be logged in to leave comments.
Login now