Files
growstuff/spec/features/signup_spec.rb
google-labs-jules[bot] 477812f06b Refactor signup feature spec to use direct database setup
- Rewrote the 'sign up for new account with existing username' test in
  spec/features/signup_spec.rb.
- Replaced UI-driven setup of an existing user with FactoryBot's `create`.
- Replaced UI navigation with a direct call to `new_member_registration_path`.
- Added an explicit assertion for the 'has already been taken' error
  message.
- Ensured a unique email is used for the second signup attempt to isolate
  the username validation check.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-03-26 06:34:32 +00:00

42 lines
1.5 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe "signup" do
it "sign up for new account from top menubar" do
visit crops_path # something other than front page, which has multiple signup links
click_link 'Sign up'
fill_in 'Login name', with: 'person123'
fill_in 'Email', with: 'gardener@example.com'
fill_in 'Password', with: 'abc123'
fill_in 'Password confirmation', with: 'abc123'
check 'member_tos_agreement'
click_button 'Sign up'
expect(page).to have_current_path root_path, ignore_query: true
end
it "sign up for new account with existing username" do
create(:member, login_name: 'person123')
visit new_member_registration_path
fill_in 'Login name', with: 'person123'
fill_in 'Email', with: 'gardener2@example.com'
fill_in 'Password', with: 'abc123'
fill_in 'Password confirmation', with: 'abc123'
check 'member_tos_agreement'
click_button 'Sign up'
expect(page).to have_content 'has already been taken'
end
it "sign up for new account without accepting TOS" do
visit root_path
first('.signup a').click # click the 'Sign up' button in the middle of the page
fill_in 'Login name', with: 'person123'
fill_in 'Email', with: 'gardener@example.com'
fill_in 'Password', with: 'abc123'
fill_in 'Password confirmation', with: 'abc123'
# do not check 'member_tos_agreement'
click_button 'Sign up'
expect(page).to have_current_path members_path, ignore_query: true
end
end