devise-guests 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +35 -0
- data/.standard.yml +2 -0
- data/Gemfile +4 -7
- data/README.md +57 -2
- data/Rakefile +13 -13
- data/config.ru +5 -3
- data/devise-guests.gemspec +10 -11
- data/lib/devise-guests/controllers/helpers.rb +12 -22
- data/lib/devise-guests/controllers/url_helpers.rb +0 -1
- data/lib/devise-guests/engine.rb +5 -7
- data/lib/devise-guests/version.rb +1 -1
- data/lib/devise-guests.rb +5 -5
- data/lib/generators/active_record/devise_guests_generator.rb +7 -7
- data/lib/generators/devise_guests/devise_guests_generator.rb +1 -2
- data/lib/railties/devise_guests.rake +2 -3
- data/spec/controllers/application_controller_spec.rb +24 -6
- data/spec/helpers/devise_guests_helpers_spec.rb +2 -3
- data/spec/integration/simple_integration_spec.rb +2 -2
- data/spec/internal/app/assets/config/manifest.js +0 -0
- data/spec/internal/app/controllers/application_controller.rb +0 -1
- data/spec/internal/app/models/user.rb +1 -2
- data/spec/internal/config/initializers/devise.rb +3 -3
- data/spec/internal/config/storage.yml +3 -0
- data/spec/internal/db/schema.rb +9 -9
- data/spec/spec_helper.rb +9 -15
- metadata +28 -10
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 776fbee405a1074096bd13610d3691a1016244e35aa1b25cd36d437077da6d56
|
4
|
+
data.tar.gz: 9d61df8e8b059d679d3a614bc6ffacd72d80a50b8568d7ab03a6aabb2e027611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9194038c18a01eaae39f335533d200e4a36acb054af5ac60f9da912b022714162d3240c4c2943bb0d58c6738a9b9e50253dafc078afc689e5055a2e16b541f67
|
7
|
+
data.tar.gz: 4538fc330f09a7678e94b3c4aa21619f93e5469cae3a4159a556c17a14f43960108aa10be69f8f42e0b9ff17ad60e9d71b8e8b8308f1d62bae12ab08471c956a
|
@@ -0,0 +1,35 @@
|
|
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: Tests
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
+
# uses: ruby/setup-ruby@v1
|
30
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rspec
|
data/.standard.yml
ADDED
data/Gemfile
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem
|
6
|
-
gem 'simplecov', :platform => :ruby_19
|
5
|
+
gem "sqlite3"
|
7
6
|
|
8
7
|
group :test do
|
9
|
-
gem
|
10
|
-
gem
|
8
|
+
gem "activerecord"
|
9
|
+
gem "actionmailer"
|
11
10
|
end
|
12
|
-
|
13
|
-
gem 'transpec'
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Devise Guests
|
2
|
-
[![
|
2
|
+
[![Tests](https://github.com/cbeer/devise-guests/actions/workflows/tests.yml/badge.svg)](https://github.com/cbeer/devise-guests/actions/workflows/tests.yml)
|
3
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
3
4
|
|
4
5
|
A drop-in guest user implementation for devise
|
5
6
|
|
@@ -33,6 +34,60 @@ current_user # (for logged in users)
|
|
33
34
|
|
34
35
|
guest_user # ( for anonymous users)
|
35
36
|
|
36
|
-
=> User<id:
|
37
|
+
=> User<id: 2, email: guest_RANDOMENOUGHSTRING_@example.com, guest: true>
|
37
38
|
|
38
39
|
```
|
40
|
+
|
41
|
+
### Transferring Guest to User on Login
|
42
|
+
|
43
|
+
During the login process you may want to transfer things from your guest user to the account the logged into.
|
44
|
+
To do so, modify your ApplicationController like so:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
define_callbacks :logging_in_user
|
48
|
+
set_callback :logging_in_user, :before, :transfer_guest_to_current_user
|
49
|
+
|
50
|
+
private
|
51
|
+
def transfer_guest_to_current_user
|
52
|
+
# At this point you have access to:
|
53
|
+
# * current_user - the user they've just logged in as
|
54
|
+
# * guest_user - the guest user they were previously identified by
|
55
|
+
#
|
56
|
+
# After this block runs, the guest_user will be destroyed!
|
57
|
+
|
58
|
+
if current_user.cart
|
59
|
+
guest_user.cart.line_items.update_all(cart_id: current_user.cart.id)
|
60
|
+
else
|
61
|
+
guest_user.cart.update!(user: current_user)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
### Custom attribute
|
67
|
+
|
68
|
+
If you have added additional authentication_keys, or have other attributes on your Devise model that you need to set
|
69
|
+
when creating a guest user, you can do so by overriding the set_guest_user_params method in your ApplicationController:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
private
|
73
|
+
def guest_user_params
|
74
|
+
{ site_id: current_site.id }
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Prevent deletion of guest records
|
79
|
+
|
80
|
+
By default, when signing in from a guest account to an authenticated account, the guest user is destroyed. You have an
|
81
|
+
opportunity through the `logging_in_user` callback (or `logging_in_MODEL` if you're not using `User`) to transfer data
|
82
|
+
from the guest to the main account before destruction occurs.
|
83
|
+
|
84
|
+
However, for some situations such as guest-checkout, you may desire that any guest account which makes a purchase does
|
85
|
+
not get destroyed. In that case you can use the `skip_destroy_guest_user` method to identify when to skip deleting these
|
86
|
+
records. By default this method returns `false`, indicating that every record is acceptable for destruction, but you
|
87
|
+
could use something like the following to optionally prevent it:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
def skip_destroy_guest_user
|
91
|
+
guest_user.orders.any?
|
92
|
+
end
|
93
|
+
```
|
data/Rakefile
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "standard/rake"
|
4
5
|
|
5
6
|
begin
|
6
7
|
Bundler.setup(:default, :development)
|
7
8
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
9
|
+
warn e.message
|
10
|
+
warn "Run `bundle install` to install missing gems"
|
10
11
|
exit e.status_code
|
11
12
|
end
|
12
13
|
|
13
|
-
task :
|
14
|
+
task default: :ci
|
14
15
|
|
15
|
-
require
|
16
|
+
require "rspec/core/rake_task"
|
16
17
|
desc "Run specs"
|
17
18
|
RSpec::Core::RakeTask.new do |t|
|
18
|
-
|
19
|
-
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
|
19
|
+
if ENV["COVERAGE"] && RUBY_VERSION =~ (/^1.8/)
|
20
20
|
t.rcov = true
|
21
|
-
t.rcov_opts = %w
|
21
|
+
t.rcov_opts = %w[--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data]
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
require
|
25
|
+
require "yard"
|
26
26
|
YARD::Rake::YardocTask.new do |t|
|
27
27
|
t.options = ["--readme", "README.md"]
|
28
28
|
end
|
29
29
|
|
30
30
|
desc "Continuous Integration build"
|
31
31
|
task :ci do
|
32
|
-
Rake::Task[
|
33
|
-
Rake::Task[
|
32
|
+
Rake::Task["spec"].invoke
|
33
|
+
Rake::Task["yard"].invoke
|
34
34
|
end
|
data/config.ru
CHANGED
data/devise-guests.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
$:.push File.expand_path("../lib", __FILE__)
|
3
2
|
require "devise-guests/version"
|
4
3
|
|
@@ -7,24 +6,25 @@ Gem::Specification.new do |s|
|
|
7
6
|
s.version = DeviseGuests::VERSION
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.authors = ["Chris Beer"]
|
10
|
-
s.email =
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
9
|
+
s.email = "chris@cbeer.info"
|
10
|
+
s.homepage = "http://github.com/cbeer/devise-guests"
|
11
|
+
s.summary = " Guest user implementation for devise "
|
12
|
+
s.description = " Guest user implementation for devise "
|
14
13
|
s.license = "MIT"
|
15
14
|
|
16
|
-
s.add_dependency
|
15
|
+
s.add_dependency "devise"
|
17
16
|
|
18
17
|
s.add_development_dependency "rspec", "~> 3.0"
|
19
18
|
s.add_development_dependency "rake"
|
20
|
-
s.add_development_dependency "combustion",
|
19
|
+
s.add_development_dependency "combustion", "~> 1.0"
|
21
20
|
s.add_development_dependency "rspec-rails"
|
22
21
|
s.add_development_dependency "capybara"
|
22
|
+
s.add_development_dependency "standard"
|
23
23
|
s.add_development_dependency "yard"
|
24
24
|
|
25
|
-
s.files
|
26
|
-
s.test_files
|
27
|
-
s.executables
|
25
|
+
s.files = `git ls-files`.split("\n")
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
28
28
|
s.extra_rdoc_files = [
|
29
29
|
"LICENSE",
|
30
30
|
"README.md"
|
@@ -32,4 +32,3 @@ Gem::Specification.new do |s|
|
|
32
32
|
|
33
33
|
s.require_paths = ["lib"]
|
34
34
|
end
|
35
|
-
|
@@ -4,37 +4,22 @@ module DeviseGuests::Controllers
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
include ActiveSupport::Callbacks
|
7
|
-
(DeviseGuests::Controllers::Helpers.callbacks || []).each do |c|
|
8
|
-
define_callbacks *c
|
9
|
-
end
|
10
|
-
|
11
7
|
end
|
12
8
|
|
13
|
-
mattr_reader :callbacks
|
14
|
-
|
15
9
|
module ClassMethods
|
16
|
-
|
17
10
|
end
|
18
11
|
|
19
|
-
def self.
|
20
|
-
@@callbacks ||= []
|
21
|
-
@@callbacks << args
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.define_helpers(mapping) #:nodoc:
|
12
|
+
def self.define_helpers(mapping) # :nodoc:
|
25
13
|
class_name = mapping.class_name
|
26
14
|
mapping = mapping.name
|
27
15
|
|
28
16
|
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
29
|
-
define_concern_callbacks :logging_in_#{mapping}
|
30
|
-
|
31
|
-
|
32
17
|
def guest_#{mapping}
|
33
18
|
return @guest_#{mapping} if @guest_#{mapping}
|
34
19
|
|
35
20
|
if session[:guest_#{mapping}_id]
|
36
21
|
@guest_#{mapping} = #{class_name}.find_by(#{class_name}.authentication_keys.first => session[:guest_#{mapping}_id]) rescue nil
|
37
|
-
@guest_#{mapping} = nil if @guest_#{mapping}.respond_to? :guest and !@guest_#{mapping}.guest
|
22
|
+
@guest_#{mapping} = nil if @guest_#{mapping}.respond_to? :guest and !@guest_#{mapping}.guest
|
38
23
|
end
|
39
24
|
|
40
25
|
@guest_#{mapping} ||= begin
|
@@ -50,7 +35,7 @@ module DeviseGuests::Controllers
|
|
50
35
|
if current_#{mapping}
|
51
36
|
if session[:guest_#{mapping}_id]
|
52
37
|
run_callbacks :logging_in_#{mapping} do
|
53
|
-
guest_#{mapping}.destroy
|
38
|
+
guest_#{mapping}.destroy unless send(:"skip_destroy_guest_#{mapping}")
|
54
39
|
session[:guest_#{mapping}_id] = nil
|
55
40
|
end
|
56
41
|
end
|
@@ -65,6 +50,7 @@ module DeviseGuests::Controllers
|
|
65
50
|
auth_key = #{class_name}.authentication_keys.first
|
66
51
|
#{class_name}.new do |g|
|
67
52
|
g.send("\#{auth_key}=", send(:"guest_\#{auth_key}_authentication_key", key))
|
53
|
+
g.assign_attributes(send(:"guest_#{mapping}_params"))
|
68
54
|
g.guest = true if g.respond_to? :guest
|
69
55
|
g.skip_confirmation! if g.respond_to?(:skip_confirmation!)
|
70
56
|
g.save(validate: false)
|
@@ -76,13 +62,16 @@ module DeviseGuests::Controllers
|
|
76
62
|
key ||= "guest_" + guest_#{mapping}_unique_suffix + "@example.com"
|
77
63
|
end
|
78
64
|
|
65
|
+
def guest_#{mapping}_params
|
66
|
+
{}
|
67
|
+
end
|
68
|
+
|
79
69
|
def guest_#{mapping}_unique_suffix
|
80
|
-
|
70
|
+
SecureRandom.uuid
|
81
71
|
end
|
82
72
|
|
83
|
-
def
|
84
|
-
|
85
|
-
@@unique_#{mapping}_counter += 1
|
73
|
+
def skip_destroy_guest_#{mapping}
|
74
|
+
false
|
86
75
|
end
|
87
76
|
|
88
77
|
METHODS
|
@@ -91,6 +80,7 @@ module DeviseGuests::Controllers
|
|
91
80
|
if respond_to?(:helper_method)
|
92
81
|
helper_method "guest_#{mapping}", "current_or_guest_#{mapping}"
|
93
82
|
end
|
83
|
+
define_callbacks "logging_in_#{mapping}"
|
94
84
|
end
|
95
85
|
end
|
96
86
|
end
|
data/lib/devise-guests/engine.rb
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails"
|
2
|
+
require "devise"
|
3
3
|
|
4
4
|
module DeviseGuests
|
5
5
|
class Engine < ::Rails::Engine
|
6
|
-
|
7
6
|
initializer "devise_guests.add_helpers" do
|
8
7
|
Devise.include_helpers(DeviseGuests::Controllers)
|
9
8
|
Devise.helpers << DeviseGuests::Controllers::Helpers
|
10
9
|
end
|
11
10
|
|
12
|
-
|
11
|
+
# This makes our rake tasks visible.
|
13
12
|
rake_tasks do
|
14
|
-
Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__),
|
15
|
-
Dir.glob(File.join(
|
13
|
+
Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), ".."))) do
|
14
|
+
Dir.glob(File.join("railties", "*.rake")).each do |railtie|
|
16
15
|
load railtie
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
data/lib/devise-guests.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "devise"
|
2
2
|
|
3
3
|
module DeviseGuests
|
4
|
-
require
|
4
|
+
require "devise-guests/version"
|
5
5
|
|
6
6
|
module Controllers
|
7
|
-
autoload :Helpers,
|
8
|
-
autoload :UrlHelpers,
|
7
|
+
autoload :Helpers, "devise-guests/controllers/helpers"
|
8
|
+
autoload :UrlHelpers, "devise-guests/controllers/url_helpers"
|
9
9
|
end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "devise-guests/engine"
|
12
12
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails/generators/active_record"
|
2
|
+
require "generators/devise/orm_helpers"
|
3
3
|
|
4
4
|
module ActiveRecord
|
5
5
|
module Generators
|
@@ -8,20 +8,20 @@ module ActiveRecord
|
|
8
8
|
source_root File.expand_path("../templates", __FILE__)
|
9
9
|
|
10
10
|
def copy_devise_migration
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
migration_template "migration_existing.rb",
|
12
|
+
"db/migrate/add_devise_guests_to_#{table_name}.rb",
|
13
|
+
migration_version: migration_version
|
14
14
|
end
|
15
15
|
|
16
16
|
def migration_data
|
17
|
-
<<RUBY
|
17
|
+
<<RUBY
|
18
18
|
## Database authenticatable
|
19
19
|
t.boolean :guest, :default => false
|
20
20
|
RUBY
|
21
21
|
end
|
22
22
|
|
23
23
|
def rails4?
|
24
|
-
Rails.version.start_with?
|
24
|
+
Rails.version.start_with? "4"
|
25
25
|
end
|
26
26
|
|
27
27
|
def migration_version
|
@@ -1,12 +1,11 @@
|
|
1
1
|
namespace :devise_guests do
|
2
2
|
# task to clean out old guest users
|
3
3
|
# rake devise_guests:delete_old_guest_users[days_old]
|
4
|
-
# example cron entry to delete users older than 7 days at 2:00 AM every day:
|
4
|
+
# example cron entry to delete users older than 7 days at 2:00 AM every day:
|
5
5
|
# 0 2 * * * cd /path/to/your/app && /path/to/rake devise_guests:delete_old_guest_users[7] RAILS_ENV=your_env
|
6
6
|
desc "Removes entries in the users table for guest users that are older than the number of days given."
|
7
7
|
task :delete_old_guest_users, [:days_old] => [:environment] do |t, args|
|
8
|
-
args.with_defaults(:
|
8
|
+
args.with_defaults(days_old: 7)
|
9
9
|
User.where("guest = ? and updated_at < ?", true, Time.now - args[:days_old].to_i.days).each { |x| x.destroy }
|
10
10
|
end
|
11
|
-
|
12
11
|
end
|
@@ -1,14 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
3
|
|
4
|
-
describe ApplicationController, :
|
4
|
+
describe ApplicationController, type: :controller do
|
5
5
|
controller do
|
6
|
-
|
7
6
|
end
|
8
7
|
|
9
8
|
before(:each) do
|
10
9
|
@mock_warden = OpenStruct.new
|
11
|
-
@controller.request.env[
|
10
|
+
@controller.request.env["warden"] = @mock_warden
|
12
11
|
end
|
13
12
|
|
14
13
|
it "should create an anonymous user for a guest" do
|
@@ -18,10 +17,29 @@ describe ApplicationController, :type => :controller do
|
|
18
17
|
end
|
19
18
|
|
20
19
|
it "should use the current user when available" do
|
21
|
-
m = double
|
20
|
+
m = double
|
22
21
|
allow(@mock_warden).to receive(:authenticate).with(anything).and_return(m)
|
23
22
|
|
24
23
|
expect(@controller.current_or_guest_user).to eq(m)
|
25
24
|
end
|
26
25
|
|
26
|
+
it "should run the 'logging_in' callbacks" do
|
27
|
+
# A user is logged in
|
28
|
+
current_user = double
|
29
|
+
allow(@controller).to receive(:current_user) { current_user }
|
30
|
+
|
31
|
+
# There is a guest user instance
|
32
|
+
guest_user = double
|
33
|
+
allow(guest_user).to receive(:destroy)
|
34
|
+
allow(@controller).to receive(:guest_user) { guest_user }
|
35
|
+
allow(@controller).to receive(:session) { {guest_user_id: 123} }
|
36
|
+
|
37
|
+
expect(@controller).to receive(:run_callbacks).with(:logging_in_user).and_call_original
|
38
|
+
|
39
|
+
@controller.current_or_guest_user
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should define a 'logging_in' callback" do
|
43
|
+
expect(@controller).to respond_to(:_logging_in_user_callbacks)
|
44
|
+
end
|
27
45
|
end
|
File without changes
|
@@ -3,6 +3,5 @@ class User < ActiveRecord::Base
|
|
3
3
|
# :token_authenticatable, :confirmable,
|
4
4
|
# :lockable, :timeoutable and :omniauthable
|
5
5
|
devise :database_authenticatable, :registerable,
|
6
|
-
|
6
|
+
:recoverable, :rememberable, :trackable, :validatable
|
7
7
|
end
|
8
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Devise.setup do |config|
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "devise/orm/active_record"
|
3
|
+
require "devise-guests"
|
4
4
|
|
5
5
|
config.helpers << DeviseGuests::Controllers::Helpers
|
6
|
-
config.secret_key =
|
6
|
+
config.secret_key = "71da52cff5ef1a77c9ccdc5153993e0e58054c288c86e005d9f7eca6ac7a9279825c7903f1de5960e900543ab0cf7f85b6d307c43b53719bebcdb9cdcfe8b7e7"
|
7
7
|
end
|
data/spec/internal/db/schema.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
ActiveRecord::Schema.define do
|
2
|
-
create_table "users", :
|
3
|
-
t.string
|
4
|
-
t.string
|
5
|
-
t.string
|
2
|
+
create_table "users", force: true do |t|
|
3
|
+
t.string "email", default: "", null: false
|
4
|
+
t.string "encrypted_password", default: "", null: false
|
5
|
+
t.string "reset_password_token"
|
6
6
|
t.datetime "reset_password_sent_at"
|
7
7
|
t.datetime "remember_created_at"
|
8
|
-
t.integer
|
8
|
+
t.integer "sign_in_count", default: 0
|
9
9
|
t.datetime "current_sign_in_at"
|
10
10
|
t.datetime "last_sign_in_at"
|
11
|
-
t.string
|
12
|
-
t.string
|
13
|
-
t.datetime "created_at",
|
14
|
-
t.datetime "updated_at",
|
11
|
+
t.string "current_sign_in_ip"
|
12
|
+
t.string "last_sign_in_ip"
|
13
|
+
t.datetime "created_at", null: false
|
14
|
+
t.datetime "updated_at", null: false
|
15
15
|
end
|
16
16
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
SimpleCov.start
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'combustion'
|
10
|
-
require 'capybara/rspec'
|
4
|
+
require "combustion"
|
5
|
+
require "capybara/rspec"
|
11
6
|
|
12
|
-
require
|
13
|
-
require
|
14
|
-
Combustion.initialize!(:active_record
|
7
|
+
require "devise"
|
8
|
+
require "devise-guests"
|
9
|
+
Combustion.initialize!(:active_record, :action_mailer)
|
15
10
|
|
16
|
-
require
|
17
|
-
require
|
11
|
+
require "rspec/rails"
|
12
|
+
require "capybara/rails"
|
18
13
|
|
19
14
|
RSpec.configure do |config|
|
20
15
|
config.infer_spec_type_from_file_location!
|
21
16
|
end
|
22
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-guests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: standard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: yard
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,8 +130,9 @@ extra_rdoc_files:
|
|
116
130
|
- LICENSE
|
117
131
|
- README.md
|
118
132
|
files:
|
133
|
+
- ".github/workflows/tests.yml"
|
119
134
|
- ".gitignore"
|
120
|
-
- ".
|
135
|
+
- ".standard.yml"
|
121
136
|
- Gemfile
|
122
137
|
- LICENSE
|
123
138
|
- README.md
|
@@ -136,11 +151,13 @@ files:
|
|
136
151
|
- spec/controllers/application_controller_spec.rb
|
137
152
|
- spec/helpers/devise_guests_helpers_spec.rb
|
138
153
|
- spec/integration/simple_integration_spec.rb
|
154
|
+
- spec/internal/app/assets/config/manifest.js
|
139
155
|
- spec/internal/app/controllers/application_controller.rb
|
140
156
|
- spec/internal/app/models/user.rb
|
141
157
|
- spec/internal/config/database.yml
|
142
158
|
- spec/internal/config/initializers/devise.rb
|
143
159
|
- spec/internal/config/routes.rb
|
160
|
+
- spec/internal/config/storage.yml
|
144
161
|
- spec/internal/db/schema.rb
|
145
162
|
- spec/internal/log/.gitignore
|
146
163
|
- spec/internal/public/favicon.ico
|
@@ -149,7 +166,7 @@ homepage: http://github.com/cbeer/devise-guests
|
|
149
166
|
licenses:
|
150
167
|
- MIT
|
151
168
|
metadata: {}
|
152
|
-
post_install_message:
|
169
|
+
post_install_message:
|
153
170
|
rdoc_options: []
|
154
171
|
require_paths:
|
155
172
|
- lib
|
@@ -164,20 +181,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
181
|
- !ruby/object:Gem::Version
|
165
182
|
version: '0'
|
166
183
|
requirements: []
|
167
|
-
|
168
|
-
|
169
|
-
signing_key:
|
184
|
+
rubygems_version: 3.0.9
|
185
|
+
signing_key:
|
170
186
|
specification_version: 4
|
171
187
|
summary: Guest user implementation for devise
|
172
188
|
test_files:
|
173
189
|
- spec/controllers/application_controller_spec.rb
|
174
190
|
- spec/helpers/devise_guests_helpers_spec.rb
|
175
191
|
- spec/integration/simple_integration_spec.rb
|
192
|
+
- spec/internal/app/assets/config/manifest.js
|
176
193
|
- spec/internal/app/controllers/application_controller.rb
|
177
194
|
- spec/internal/app/models/user.rb
|
178
195
|
- spec/internal/config/database.yml
|
179
196
|
- spec/internal/config/initializers/devise.rb
|
180
197
|
- spec/internal/config/routes.rb
|
198
|
+
- spec/internal/config/storage.yml
|
181
199
|
- spec/internal/db/schema.rb
|
182
200
|
- spec/internal/log/.gitignore
|
183
201
|
- spec/internal/public/favicon.ico
|