From: Anton Khorev Date: Sat, 10 Feb 2024 14:26:57 +0000 (+0300) Subject: Move system test specific sign in to system test superclass X-Git-Tag: live~788^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/956ba386d684a8788eb3e96aa13fc82480b3f1c5 Move system test specific sign in to system test superclass --- diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index b170e74b1..7931546d4 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -24,6 +24,15 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase private + def sign_in_as(user) + visit login_path + within "form", :text => "Email Address or Username" do + fill_in "username", :with => user.email + fill_in "password", :with => "test" + click_on "Login" + end + end + def within_sidebar(&block) within "#sidebar_content", &block end diff --git a/test/test_helper.rb b/test/test_helper.rb index e1bc91917..60edf6e0c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -242,15 +242,6 @@ module ActiveSupport end end - def sign_in_as(user) - visit login_path - within "form", :text => "Email Address or Username" do - fill_in "username", :with => user.email - fill_in "password", :with => "test" - click_on "Login" - end - end - def session_for(user) get login_path post login_path, :params => { :username => user.display_name, :password => "test" }