devise-remote-user 0.3.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +53 -0
- data/.gitignore +1 -0
- data/Gemfile +37 -1
- data/LICENSE +2 -2
- data/README.md +7 -2
- data/Rakefile +4 -8
- data/{devise_remote_user.gemspec → devise-remote-user.gemspec} +3 -3
- data/lib/devise-remote-user.rb +1 -0
- data/lib/devise_remote_user.rb +20 -14
- data/lib/devise_remote_user/controller_behavior.rb +1 -1
- data/lib/devise_remote_user/manager.rb +15 -10
- data/lib/devise_remote_user/model.rb +3 -5
- data/lib/devise_remote_user/strategy.rb +1 -1
- data/lib/devise_remote_user/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +11 -11
- data/spec/controllers/devise/sessions_controller_spec.rb +2 -3
- data/spec/lib/devise_remote_user_spec.rb +50 -0
- data/spec/spec_helper.rb +36 -8
- data/spec/{dummy/db/migrate → test_app_templates}/20131101184256_add_name_fields_to_user.rb +1 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +34 -0
- metadata +45 -157
- data/spec/controllers/application_controller_spec.rb~ +0 -9
- data/spec/controllers/devise/sessions_controller_spec.rb~ +0 -20
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -13
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +0 -4
- data/spec/dummy/app/models/user.rb~ +0 -6
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/devise.rb +0 -258
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/devise.en.yml +0 -60
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/db/migrate/20131101150807_devise_create_users.rb +0 -42
- data/spec/dummy/db/migrate/20131101184256_add_name_fields_to_user.rb~ +0 -4
- data/spec/dummy/db/schema.rb +0 -38
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/features/#logout_spec.rb# +0 -1
- data/spec/factories/user_factories.rb~ +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b0bc0c09a06a85bf6f7687427ed0d69edbbc88ba8226e7f2bac9681f32899b32
|
4
|
+
data.tar.gz: 9c33250b5d3030529833b9f201400dbdc7ff665bca38fb752746d7cfa2915afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac419491667ab37ac90bb2e12902bd10288567ddc5ee9bf879651702fb0b19bce14cdd254e07c82f9f8aab4f40f3bc50980852205b49b52c76fef6b4d80c586
|
7
|
+
data.tar.gz: 2e1c68da7663909782cce96a34d5b1e58b648c46f35adb388e655534dc346b4bbac81cb550034d30a2e0968fa17da08fee2756ac98b992ace040d3be2fc07833
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: CI
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
strategy:
|
20
|
+
matrix:
|
21
|
+
ruby: [2.6, 2.7]
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
- name: Set up Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
- name: Install dependencies
|
29
|
+
run: bundle install
|
30
|
+
- name: Run tests
|
31
|
+
run: bundle exec rake ci
|
32
|
+
env:
|
33
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
34
|
+
test_rails5:
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
strategy:
|
37
|
+
matrix:
|
38
|
+
ruby: [2.6, 2.7]
|
39
|
+
steps:
|
40
|
+
- uses: actions/checkout@v2
|
41
|
+
- name: Set up Ruby
|
42
|
+
uses: ruby/setup-ruby@v1
|
43
|
+
with:
|
44
|
+
ruby-version: ${{ matrix.ruby }}
|
45
|
+
- name: Install dependencies
|
46
|
+
run: bundle install
|
47
|
+
env:
|
48
|
+
RAILS_VERSION: 5.2.4.4
|
49
|
+
- name: Run tests
|
50
|
+
run: bundle exec rake ci
|
51
|
+
env:
|
52
|
+
RAILS_VERSION: 5.2.4.4
|
53
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,39 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem "coveralls", require: false
|
6
|
+
|
7
|
+
# BEGIN ENGINE_CART BLOCK
|
8
|
+
# engine_cart: 0.10.0
|
9
|
+
# engine_cart stanza: 0.10.0
|
10
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
11
|
+
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
|
12
|
+
if File.exist?(file)
|
13
|
+
begin
|
14
|
+
eval_gemfile file
|
15
|
+
rescue Bundler::GemfileError => e
|
16
|
+
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
|
17
|
+
Bundler.ui.warn e.message
|
18
|
+
end
|
19
|
+
else
|
20
|
+
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
|
21
|
+
|
22
|
+
if ENV['RAILS_VERSION']
|
23
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
24
|
+
gem 'rails', github: 'rails/rails'
|
25
|
+
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
|
26
|
+
else
|
27
|
+
gem 'rails', ENV['RAILS_VERSION']
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
case ENV['RAILS_VERSION']
|
32
|
+
when /^6.0/
|
33
|
+
gem 'sass-rails', '>= 6'
|
34
|
+
# gem 'webpacker', '~> 4.0'
|
35
|
+
when /^5.[12]/
|
36
|
+
gem 'sass-rails', '~> 5.0'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# END ENGINE_CART BLOCK
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) Duke University.
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -11,7 +11,7 @@ are permitted provided that the following conditions are met:
|
|
11
11
|
list of conditions and the following disclaimer in the documentation and/or
|
12
12
|
other materials provided with the distribution.
|
13
13
|
|
14
|
-
Neither the name of
|
14
|
+
Neither the name of Duke University nor the names of its
|
15
15
|
contributors may be used to endorse or promote products derived from
|
16
16
|
this software without specific prior written permission.
|
17
17
|
|
data/README.md
CHANGED
@@ -3,6 +3,11 @@ devise-remote-user
|
|
3
3
|
|
4
4
|
A devise extension for remote user authentication.
|
5
5
|
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/devise-remote-user.svg)](http://badge.fury.io/rb/devise-remote-user)
|
7
|
+
[![Build Status](https://github.com/duke-libraries/devise-remote-user/workflows/CI/badge.svg)](https://github.com/duke-libraries/devise-remote-user/actions?query=branch%3Amaster)
|
8
|
+
[![Coverage Status](https://coveralls.io/repos/duke-libraries/devise-remote-user/badge.png?branch=master)](https://coveralls.io/r/duke-libraries/devise-remote-user?branch=master)
|
9
|
+
[![Code Climate](https://codeclimate.com/github/duke-libraries/devise-remote-user/badges/gpa.svg)](https://codeclimate.com/github/duke-libraries/devise-remote-user)
|
10
|
+
|
6
11
|
## Installation
|
7
12
|
|
8
13
|
Add to Gemfile:
|
@@ -24,7 +29,7 @@ Sorry, there are no generators yet, so ...
|
|
24
29
|
|
25
30
|
Configuration options:
|
26
31
|
|
27
|
-
- `
|
32
|
+
- `env_key` - String (default: `'REMOTE_USER'`). Request environment key for the remote user id.
|
28
33
|
- `attribute_map` - Hash (default: `{}`). Map of User model attributes to request environment keys for updating the local user when auto-creation is enabled.
|
29
34
|
- `auto_create` - Boolean (default: `false`). Whether to auto-create a local user from the remote user attributes. Note: Also requires adding the Warden callbacks as shown below.
|
30
35
|
- `auto_update` - Boolean (default: `false`). Whether to auto-update authenticated user attributes from remote user attributes.
|
@@ -46,4 +51,4 @@ end
|
|
46
51
|
|
47
52
|
## Tests
|
48
53
|
|
49
|
-
`rake
|
54
|
+
`rake ci` runs the test suite.
|
data/Rakefile
CHANGED
@@ -4,17 +4,13 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
8
|
-
load 'rails/tasks/engine.rake'
|
9
|
-
|
10
7
|
Bundler::GemHelper.install_tasks
|
11
8
|
|
12
|
-
|
9
|
+
task default: :ci
|
13
10
|
|
14
|
-
require 'rspec/core'
|
15
11
|
require 'rspec/core/rake_task'
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
13
|
|
17
|
-
|
18
|
-
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
14
|
+
require 'engine_cart/rake_task'
|
19
15
|
|
20
|
-
task :
|
16
|
+
task ci: ['engine_cart:generate', 'spec']
|
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = Dir["spec/**/*"]
|
19
19
|
s.extra_rdoc_files = ["LICENSE", "README.md"]
|
20
20
|
s.require_paths = ["lib"]
|
21
|
-
s.add_dependency "rails", ">= 3.2", "< 5.0"
|
22
21
|
s.add_dependency "devise"
|
23
22
|
s.add_development_dependency "sqlite3"
|
24
|
-
s.add_development_dependency "rspec-rails", "~>
|
23
|
+
s.add_development_dependency "rspec-rails", "~> 3.4"
|
25
24
|
s.add_development_dependency "factory_girl_rails"
|
26
25
|
s.add_development_dependency "capybara"
|
27
|
-
|
26
|
+
s.add_development_dependency "engine_cart", "~> 2.0"
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'devise_remote_user'
|
data/lib/devise_remote_user.rb
CHANGED
@@ -3,38 +3,45 @@ require 'devise_remote_user/engine'
|
|
3
3
|
require 'devise_remote_user/controller_behavior'
|
4
4
|
|
5
5
|
module DeviseRemoteUser
|
6
|
+
class << self
|
7
|
+
attr_accessor :env_key, :auto_create, :auto_update, :auth_key, :attribute_map, :logout_url
|
8
|
+
end
|
6
9
|
|
7
10
|
# request.env key for remote user name
|
8
11
|
# Set to 'HTTP_REMOTE_USER' in config/initializers/devise.rb if behind reverse proxy
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
self.env_key = 'REMOTE_USER'
|
13
|
+
|
12
14
|
# Enable user auto-creation of user from remote user attributes
|
13
|
-
|
14
|
-
@@auto_create = false
|
15
|
+
self.auto_create = false
|
15
16
|
|
16
17
|
# Enable user auto-update of user attributes from remote user attributes
|
17
|
-
|
18
|
-
@@auto_update = false
|
18
|
+
self.auto_update = false
|
19
19
|
|
20
20
|
# User attribute used for lookup of remote user
|
21
21
|
# Defaults to Devise.authentication_keys.first
|
22
|
-
|
23
|
-
@@auth_key = nil
|
22
|
+
self.auth_key = nil
|
24
23
|
|
25
24
|
# Map of User model attributes to request.env keys for updating a local user when auto-creation is enabled.
|
26
|
-
|
27
|
-
@@attribute_map = {}
|
25
|
+
self.attribute_map = {}
|
28
26
|
|
29
27
|
# Settings for redirecting to the remote user logout URL
|
30
28
|
# Enable by including DeviseRemoteUser::Controllers::Helpers in ApplicationController
|
31
29
|
# (it overrides Devise's after_sign_out_path_for method).
|
32
|
-
|
33
|
-
|
30
|
+
self.logout_url = '/'
|
31
|
+
|
34
32
|
|
35
33
|
def self.configure
|
36
34
|
yield self
|
37
35
|
end
|
36
|
+
|
37
|
+
def self.remote_user_id env
|
38
|
+
case env_key
|
39
|
+
when Proc
|
40
|
+
env_key.call(env)
|
41
|
+
else
|
42
|
+
env[env_key]
|
43
|
+
end
|
44
|
+
end
|
38
45
|
|
39
46
|
end
|
40
47
|
|
@@ -42,4 +49,3 @@ Devise.add_module(:remote_user_authenticatable,
|
|
42
49
|
:strategy => true,
|
43
50
|
:controller => :sessions,
|
44
51
|
:model => 'devise_remote_user/model')
|
45
|
-
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module DeviseRemoteUser
|
2
2
|
|
3
3
|
#
|
4
|
-
# The Manager class is responsible for connecting the appliation's User
|
4
|
+
# The Manager class is responsible for connecting the appliation's User
|
5
5
|
# class with remote user information in the request environment.
|
6
6
|
#
|
7
7
|
class Manager
|
8
8
|
|
9
|
-
attr_reader :env
|
10
|
-
|
11
|
-
def initialize(env)
|
9
|
+
attr_reader :klass, :env
|
10
|
+
|
11
|
+
def initialize(klass, env)
|
12
|
+
@klass = klass
|
12
13
|
@env = env
|
13
14
|
end
|
14
15
|
|
@@ -22,21 +23,25 @@ module DeviseRemoteUser
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def find_user
|
25
|
-
|
26
|
+
klass.where(user_criterion).first
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_user
|
30
|
+
unless Devise.mappings[:user].strategies.include?(:database_authenticatable)
|
31
|
+
return klass.create(user_criterion)
|
32
|
+
end
|
33
|
+
|
29
34
|
random_password = SecureRandom.hex(16)
|
30
35
|
attrs = user_criterion.merge({password: random_password, password_confirmation: random_password})
|
31
|
-
|
36
|
+
klass.create(attrs)
|
32
37
|
end
|
33
38
|
|
34
39
|
def update_user(user)
|
35
|
-
user.
|
40
|
+
user.update(remote_user_attributes)
|
36
41
|
end
|
37
42
|
|
38
43
|
protected
|
39
|
-
|
44
|
+
|
40
45
|
def remote_user_attributes
|
41
46
|
DeviseRemoteUser.attribute_map.inject({}) { |h, (k, v)| h[k] = env[v] if env.has_key?(v); h }
|
42
47
|
end
|
@@ -46,13 +51,13 @@ module DeviseRemoteUser
|
|
46
51
|
end
|
47
52
|
|
48
53
|
def remote_user_id
|
49
|
-
|
54
|
+
DeviseRemoteUser.remote_user_id(env)
|
50
55
|
end
|
51
56
|
|
52
57
|
def auth_key
|
53
58
|
DeviseRemoteUser.auth_key || Devise.authentication_keys.first
|
54
59
|
end
|
55
|
-
|
60
|
+
|
56
61
|
end
|
57
62
|
|
58
63
|
end
|
@@ -5,13 +5,11 @@ module Devise::Models
|
|
5
5
|
module RemoteUserAuthenticatable
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
manager = DeviseRemoteUser::Manager.new(env)
|
8
|
+
included do
|
9
|
+
def self.find_for_remote_user_authentication(env)
|
10
|
+
manager = DeviseRemoteUser::Manager.new(self, env)
|
12
11
|
manager.find_or_create_user
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
14
|
|
17
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ApplicationController do
|
3
|
+
RSpec.describe ApplicationController, type: :controller do
|
4
4
|
|
5
5
|
controller do
|
6
6
|
def remote_user_name=(user_name)
|
@@ -21,7 +21,7 @@ describe ApplicationController do
|
|
21
21
|
before { controller.remote_user_name = user.email }
|
22
22
|
it "should login the remote user" do
|
23
23
|
get :index
|
24
|
-
expect(controller.user_signed_in?).to
|
24
|
+
expect(controller.user_signed_in?).to eq true
|
25
25
|
expect(controller.current_user).to eq(user)
|
26
26
|
end
|
27
27
|
end
|
@@ -30,7 +30,7 @@ describe ApplicationController do
|
|
30
30
|
before { controller.remote_user_name = nil }
|
31
31
|
it "should do nothing" do
|
32
32
|
get :index
|
33
|
-
expect(controller.user_signed_in?).to
|
33
|
+
expect(controller.user_signed_in?).to eq false
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -43,18 +43,18 @@ describe ApplicationController do
|
|
43
43
|
it "should create and sign in a new user" do
|
44
44
|
get :index
|
45
45
|
expect(response).to be_successful
|
46
|
-
expect(controller.user_signed_in?).to
|
46
|
+
expect(controller.user_signed_in?).to eq true
|
47
47
|
expect(User.find_by_email(email)).to eq(controller.current_user)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "and auto-creation is disabled" do
|
52
|
-
before { allow(DeviseRemoteUser).to receive(:auto_create)
|
52
|
+
before { allow(DeviseRemoteUser).to receive(:auto_create).and_return(false) }
|
53
53
|
it "should not create a user for the remote user" do
|
54
54
|
get :index
|
55
|
-
response.
|
56
|
-
controller.user_signed_in
|
57
|
-
User.find_by_email(email).
|
55
|
+
expect(response).to_not be_successful
|
56
|
+
expect(controller.user_signed_in?).to eq false
|
57
|
+
expect(User.find_by_email(email)).to be_nil
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -62,7 +62,7 @@ describe ApplicationController do
|
|
62
62
|
describe "when a local database user is already signed in" do
|
63
63
|
let(:local_user) { FactoryGirl.create(:user) }
|
64
64
|
before do
|
65
|
-
allow(DeviseRemoteUser).to receive(:auto_create)
|
65
|
+
allow(DeviseRemoteUser).to receive(:auto_create).and_return(true)
|
66
66
|
controller.remote_user_name = remote_user.email
|
67
67
|
sign_in local_user
|
68
68
|
end
|
@@ -100,7 +100,7 @@ describe ApplicationController do
|
|
100
100
|
|
101
101
|
describe "when auto-creation is disabled" do
|
102
102
|
before do
|
103
|
-
allow(DeviseRemoteUser).to receive(:auto_update)
|
103
|
+
allow(DeviseRemoteUser).to receive(:auto_update).and_return(false)
|
104
104
|
controller.remote_user_name = user.email
|
105
105
|
controller.remote_user_attributes = {
|
106
106
|
'givenName' => 'Fleece',
|
@@ -121,7 +121,7 @@ describe ApplicationController do
|
|
121
121
|
|
122
122
|
describe "when auto-creation is enabled" do
|
123
123
|
before do
|
124
|
-
allow(DeviseRemoteUser).to receive(:auto_update)
|
124
|
+
allow(DeviseRemoteUser).to receive(:auto_update).and_return(true)
|
125
125
|
controller.remote_user_attributes = {
|
126
126
|
'givenName' => 'Fleece',
|
127
127
|
'sn' => 'Vest',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Devise::SessionsController do
|
3
|
+
RSpec.describe Devise::SessionsController, type: :controller do
|
4
4
|
before { @request.env["devise.mapping"] = Devise.mappings[:user] }
|
5
5
|
describe "logout" do
|
6
6
|
let(:user) { FactoryGirl.create(:user) }
|
@@ -12,9 +12,8 @@ describe Devise::SessionsController do
|
|
12
12
|
end
|
13
13
|
describe "when user is not remotely authenticated" do
|
14
14
|
it "should redirect to the root path (Devise default)" do
|
15
|
-
expect(get :destroy).to redirect_to(
|
15
|
+
expect(get :destroy).to redirect_to('/')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
20
19
|
end
|