dawarich/spec/support/system_helpers.rb

25 lines
696 B
Ruby
Raw Normal View History

2025-05-26 14:33:48 -04:00
# frozen_string_literal: true
module SystemHelpers
include Rails.application.routes.url_helpers
2025-05-26 14:33:48 -04:00
def sign_in_user(user, password = 'password123')
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)
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
config.include Rails.application.routes.url_helpers, type: :system
2025-05-26 14:33:48 -04:00
end