From 462002c416c0d16666e64d62b5c752e677c3373b Mon Sep 17 00:00:00 2001 From: riggraz Date: Tue, 20 Aug 2019 14:26:26 +0200 Subject: [PATCH] Add users factory for tests --- config/environments/test.rb | 3 +++ spec/factories/users.rb | 3 +++ spec/system/session_spec.rb | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 spec/system/session_spec.rb diff --git a/config/environments/test.rb b/config/environments/test.rb index de83a778..d2e13af7 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -6,6 +6,9 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + # For Devise + config.action_mailer.default_url_options = { host: 'localhost:3000' } + config.cache_classes = false # Do not eager load code on boot. This avoids loading your whole application diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 628434c3..aca14d20 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,5 +1,8 @@ FactoryBot.define do factory :user do + sequence(:email) { |n| "user#{n}@example.com" } + full_name { "First Last" } + password { "password" } end end diff --git a/spec/system/session_spec.rb b/spec/system/session_spec.rb new file mode 100644 index 00000000..c1a9acb9 --- /dev/null +++ b/spec/system/session_spec.rb @@ -0,0 +1,20 @@ +require 'rails_helper' + +RSpec.describe "Session", type: :system do + + # def log_in_as(user) + # visit new_user_session_path + # fill_in "Email", with: "user0@example.com" + # fill_in "Password", with: "password" + # click_button "Log in" + # end + + # let(:user) { FactoryBot.create(:user) } + + # it 'allows a logged-in user to view profile settings' do + # log_in_as user + # visit edit_user_registration_path + # expect(current_path).to eq(edit_user_registration_path) + # end + +end \ No newline at end of file