From 3b3608ba015db3b3453f3a7d2d9f88622a994f0e Mon Sep 17 00:00:00 2001 From: Helge Rausch Date: Fri, 30 Aug 2024 13:56:30 +0200 Subject: [PATCH] Add test for login of existing user --- spec/features/login_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index d429f799..e1e25f2d 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -45,4 +45,26 @@ end end end + + context "for existing users" do + let!(:user) do + create( + :user, + email: "user@example.com", + password_salt: "r138v6Tx3iqYNPPdfWnV", + crypted_password: "$2a$10$8kSlpLxvB/psmMrmpIWmYOnM2wu/R8XUn8XvBaCTl6Tcu80LFudLe", + persistence_token: "d078ab6ddb7375ca7fe652b2beef3e2dd2308c5c5a5cec803378436e710e201bc088d3f55f6858c187ed6ba30e7f2282ebb68b1cdddd36c7d8f607f5f178e51a", + perishable_token: "lk8z9uiBMhJWoYx3syIM", + ) + end + + it "allows them to log in" do + visit(root_path) + click_on("Sign In") + fill_in('Email', with: 'user@example.com') + fill_in('Password', with: 'secretly') + click_on('Login') + expect(page).to have_content('Login successful!') + end + end end