27 lines
854 B
Ruby
27 lines
854 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "application_system_test_case"
|
|
|
|
class SignUpsTest < ApplicationSystemTestCase
|
|
test "can log in, then out" do
|
|
visit new_session_url
|
|
fill_in attr_name(User, :username), with: users(:trevor).username
|
|
fill_in attr_name(User, :password), with: "password"
|
|
click_button I18n.t("sessions.new.log_in")
|
|
|
|
assert_text I18n.t("sessions.create.success", name: users(:trevor).first_name)
|
|
|
|
click_on I18n.t("sessions.destroy.log_out")
|
|
assert_text I18n.t("sessions.destroy.success")
|
|
end
|
|
|
|
test "unverified users cannot log in" do
|
|
visit new_session_url
|
|
fill_in attr_name(User, :username), with: users(:unverified).username
|
|
fill_in attr_name(User, :password), with: "password"
|
|
click_button I18n.t("sessions.new.log_in")
|
|
|
|
assert_text I18n.t("sessions.create.not_verified")
|
|
end
|
|
end
|