2025-05-26 14:33:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
module SystemHelpers
|
2025-07-09 15:25:56 -04:00
|
|
|
include Rails.application.routes.url_helpers
|
|
|
|
|
|
2025-05-26 14:33:48 -04:00
|
|
|
def sign_in_user(user, password = 'password123')
|
2025-07-09 15:25:56 -04:00
|
|
|
visit '/users/sign_in'
|
|
|
|
|
expect(page).to have_field('Email', wait: 10)
|
2025-05-26 14:33:48 -04:00
|
|
|
fill_in 'Email', with: user.email
|
|
|
|
|
fill_in 'Password', with: password
|
|
|
|
|
click_button 'Log in'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sign_in_and_visit_map(user, password = 'password123')
|
|
|
|
|
sign_in_user(user, password)
|
2025-07-09 15:25:56 -04:00
|
|
|
expect(page).to have_current_path('/map')
|
2025-05-26 14:33:48 -04:00
|
|
|
expect(page).to have_css('.leaflet-container', wait: 10)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
|
config.include SystemHelpers, type: :system
|
2025-07-09 15:25:56 -04:00
|
|
|
config.include Rails.application.routes.url_helpers, type: :system
|
2025-05-26 14:33:48 -04:00
|
|
|
end
|