Skip to content

Commit 8f9eb72

Browse files
committed
update authentication helpers for tests
1 parent ecbf136 commit 8f9eb72

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ GEM
165165
thor (~> 1.3)
166166
zeitwerk (>= 2.6.18, < 3.0)
167167
language_server-protocol (3.17.0.4)
168-
listen (3.9.0)
169-
rb-fsevent (~> 0.10, >= 0.10.3)
170-
rb-inotify (~> 0.9, >= 0.9.10)
171168
launchy (3.1.0)
172169
addressable (~> 2.8)
173170
childprocess (~> 5.0)
174171
logger (~> 1.6)
175172
letter_opener (1.10.0)
176173
launchy (>= 2.2, < 4)
174+
listen (3.9.0)
175+
rb-fsevent (~> 0.10, >= 0.10.3)
176+
rb-inotify (~> 0.9, >= 0.9.10)
177177
logger (1.6.5)
178178
loofah (2.24.0)
179179
crass (~> 1.0.2)

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Rails.application.routes.draw do
22
resources :regions
3-
mount Maily::Engine, at: "/maily"
3+
(mount Maily::Engine, at: "/maily") if defined?(Maily)
44
root "home#index"
55
get "home/index", as: :home
66
resource :session

lib/maily_hooks.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
user = ""
1+
if defined?(Maily)
2+
user = ""
23

3-
Maily.hooks_for("PasswordsMailer") do |mailer|
4-
mailer.register_hook(:reset, user)
4+
Maily.hooks_for("PasswordsMailer") do |mailer|
5+
mailer.register_hook(:reset, user)
6+
end
57
end

spec/requests/regions_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
# This spec was generated by rspec-rails when you ran the scaffold generator.
44
# It demonstrates how one might use RSpec to test the controller code that
@@ -15,8 +15,6 @@
1515
RSpec.describe "/regions", type: :request do
1616
let(:user) { create(:user) }
1717

18-
include AuthHelper
19-
2018
before do
2119
sign_in(user)
2220
end

spec/support/authentication_helper.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module AuthenticationHelpers
2+
def sign_in(user)
3+
post session_url, params: { email: user.email, password: user.password }
4+
end
5+
end
6+
7+
RSpec.configure do |config|
8+
config.include AuthenticationHelpers, type: :request
9+
end

0 commit comments

Comments
 (0)