Add first system tests
This commit is contained in:
parent
43aaed3162
commit
82a7510d18
|
@ -1,5 +1,7 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||||
driven_by :selenium, using: :chrome, screen_size: [ 1400, 1400 ]
|
driven_by :selenium,
|
||||||
|
using: :headless_firefox,
|
||||||
|
screen_size: [ 1400, 1400 ]
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class SignUpsTest < ApplicationSystemTestCase
|
||||||
|
test "can sign up" do
|
||||||
|
visit new_user_url
|
||||||
|
fill_in attr_name(User, :username), with: "awesome_user"
|
||||||
|
fill_in attr_name(User, :first_name), with: "Awesome"
|
||||||
|
fill_in attr_name(User, :last_name), with: "User"
|
||||||
|
fill_in attr_name(User, :email), with: "awesome_user@example.com"
|
||||||
|
fill_in attr_name(User, :password), with: "password"
|
||||||
|
fill_in attr_name(User, :password_confirmation), with: "password"
|
||||||
|
click_on I18n.t("users.new.sign_up")
|
||||||
|
|
||||||
|
assert_text I18n.t("users.create.success", name: "Awesome")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "can validate email address" do
|
||||||
|
user = users(:unverified)
|
||||||
|
token = user.generate_token_for(:email_verification)
|
||||||
|
|
||||||
|
visit account_verification_url(id: token)
|
||||||
|
assert_text I18n.t("account_verifications.show.success")
|
||||||
|
end
|
||||||
|
end
|
|
@ -17,5 +17,9 @@ module ActiveSupport
|
||||||
assert_includes record.errors[field.to_sym], "can't be blank"
|
assert_includes record.errors[field.to_sym], "can't be blank"
|
||||||
assert_raises { record.save(validate: false) }
|
assert_raises { record.save(validate: false) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def attr_name(klass, attr)
|
||||||
|
klass.human_attribute_name(attr)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue