Show More
Commit Description:
Merge pull request #17 from nattee/master...
Commit Description:
Merge pull request #17 from nattee/master
upgrade to current working snapshot
References:
File last commit:
Show/Diff file:
Action:
test/integration/login_test.rb
| 40 lines
| 1.2 KiB
| text/x-ruby
| RubyLexer
|
r622 | require 'test_helper' | |||
class LoginTest < ActionDispatch::IntegrationTest | ||||
# test "the truth" do | ||||
# assert true | ||||
# end | ||||
r626 | test "login with invalid information" do | |||
get root_path | ||||
assert_response :success | ||||
post login_login_path, login: "root", password: "hahaha" | ||||
assert_redirected_to root_path | ||||
end | ||||
test "normal user login" do | ||||
r622 | get root_path | |||
assert_response :success | ||||
r626 | post login_login_path, {login: "john", password: "hello" } | |||
assert_redirected_to main_list_path | ||||
end | ||||
r622 | ||||
r626 | test "normal user login in single_user mode" do | |||
r627 | GraderConfiguration.find_by(key: GraderConfiguration::SINGLE_USER_KEY).update_attributes(value: 'true') | |||
GraderConfiguration.reload | ||||
r626 | get root_path | |||
assert_response :success | ||||
post login_login_path, {login: "john", password: "hello" } | ||||
r627 | follow_redirect! | |||
r626 | assert_redirected_to root_path | |||
end | ||||
test "root login in in single_user mode" do | ||||
r627 | GraderConfiguration.find_by(key: GraderConfiguration::SINGLE_USER_KEY).update_attributes(value: 'true') | |||
GraderConfiguration.reload | ||||
r626 | get root_path | |||
assert_response :success | ||||
post login_login_path, {login: "admin", password: "admin" } | ||||
assert_redirected_to main_list_path | ||||
r622 | end | |||
end | ||||