simple_auth 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -2
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +17 -3
  5. data/CHANGELOG.md +9 -1
  6. data/Gemfile +2 -0
  7. data/README.md +41 -12
  8. data/Rakefile +3 -1
  9. data/bin/console +2 -0
  10. data/gemfiles/rails_5_2.gemfile +6 -0
  11. data/gemfiles/rails_6_0.gemfile +6 -0
  12. data/lib/simple_auth.rb +3 -0
  13. data/lib/simple_auth/action_controller.rb +6 -7
  14. data/lib/simple_auth/action_controller/require_login_action.rb +11 -9
  15. data/lib/simple_auth/config.rb +2 -0
  16. data/lib/simple_auth/generator.rb +2 -0
  17. data/lib/simple_auth/railtie.rb +2 -0
  18. data/lib/simple_auth/session.rb +5 -6
  19. data/lib/simple_auth/templates/install/initializer.rb +2 -0
  20. data/lib/simple_auth/version.rb +3 -1
  21. data/simple_auth.gemspec +12 -5
  22. data/test/controllers/admin/dashboard_controller_test.rb +2 -0
  23. data/test/controllers/dashboard_controller_test.rb +2 -0
  24. data/test/controllers/pages_controller_test.rb +21 -1
  25. data/test/generators/install_test.rb +2 -0
  26. data/test/support/dummy/app/controllers/admin/dashboard_controller.rb +3 -3
  27. data/test/support/dummy/app/controllers/application_controller.rb +2 -0
  28. data/test/support/dummy/app/controllers/dashboard_controller.rb +3 -3
  29. data/test/support/dummy/app/controllers/pages_controller.rb +12 -1
  30. data/test/support/dummy/app/models/user.rb +2 -0
  31. data/test/support/dummy/config/application.rb +2 -0
  32. data/test/support/dummy/config/initializers/simple_auth.rb +2 -0
  33. data/test/support/dummy/config/routes.rb +4 -0
  34. data/test/support/schema.rb +2 -0
  35. data/test/test_helper.rb +5 -1
  36. metadata +74 -18
  37. data/gemfiles/rails_4_2.gemfile +0 -4
  38. data/gemfiles/rails_5_0.gemfile +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1de8cb8aeaa7b6bfee0b0a72545d2a466b931837
4
- data.tar.gz: f4319e57e9226858d1b90e9b8d2aa84c684b21ef
2
+ SHA256:
3
+ metadata.gz: ba465a655d4336e0e400a40306644584f5dc0e9fd1be216272d12f9326e01467
4
+ data.tar.gz: d92099b4d135f1e36c195996c14972ff6ad55e20c1d3e7d920909c3b525b11c5
5
5
  SHA512:
6
- metadata.gz: 66b65c80f6776fc1fff063e454614639e8916c33a16bf8e381abb2bc1b400ca470d3c0a2f876945f3ce753d25d7e02b32b670cabc81ff21e0181c8d1d428d6f9
7
- data.tar.gz: 80386bfdc372ce83bf8ef03b18081d2b6415fb0b92925a00bb26bfa8415bdf3d320c59c825a683e3e1e9cbdff72f981a50bb54e883ed8532695c46a614f94a3f
6
+ metadata.gz: cbe00d05c29d18d067f4decc46ab3cd1a70d72cb6e8e6bd42f16f9601b4dea552f5b6b2d6504632b4a49f01458f9e313bfa60ee65785d019c7aadb2bd86b66da
7
+ data.tar.gz: 71c868b0d198cf63139168545155eabe87f23cd4558f8f11e289a29917bca7fc196c6ce158a2da10c30d8922599889f9f8ed821e1872f5ea3d43c76d3fca2ba0
data/.gitignore CHANGED
@@ -3,8 +3,8 @@ pkg
3
3
  .rvmrc
4
4
  log
5
5
  .bundle
6
- gemfiles/*.lock
7
- Gemfile.lock
8
6
  *.log
9
7
  /tmp
10
8
  /log
9
+ /coverage
10
+ *.lock
@@ -0,0 +1,6 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
@@ -1,8 +1,22 @@
1
+ ---
1
2
  sudo: false
2
3
  cache: bundler
3
4
  rvm:
4
- - "2.2.4"
5
+ - 2.7.0
6
+ - 2.6.5
7
+ - 2.5.7
5
8
  script: bundle exec rake
9
+ before_script:
10
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
+ - chmod +x ./cc-test-reporter
12
+ - "./cc-test-reporter before-build"
13
+ after_script:
14
+ - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
15
+ notifications:
16
+ email: false
6
17
  gemfile:
7
- - gemfiles/rails_4_2.gemfile
8
- - gemfiles/rails_5_0.gemfile
18
+ - gemfiles/rails_6_0.gemfile
19
+ - gemfiles/rails_5_2.gemfile
20
+ env:
21
+ global:
22
+ secure: LglasZ2QJLCE2tSKyZ9wIZNNwDNQ/gi+QNSHlpK2olgBOYMKV1idJPZjUlSTAac7+QHTYRRGCoUVMYHWxJgLfcuo7YpXVAgqPwjVl5nbHKfh/oP/FLriELKZbqMo0TtuqZNdnqPdO8RE7zK0om37jYNoUPJ4j2mUVLC8PMZpbiM=
@@ -1,4 +1,12 @@
1
- #v3.0.0
1
+ # v3.1.0
2
+
3
+ - SimpleAuth now uses [GlobalID](https://github.com/rails/globalid) as the
4
+ identification that's saved on the session. This should be a seamless
5
+ migration (users will only have to re-login). This allows using any objects
6
+ that respond to `#to_gid`, including namespaced models and POROs.
7
+
8
+ # v3.0.0
9
+
2
10
  - Reimplemented library.
3
11
  - Add support for scoped authentication (e.g. user and admin).
4
12
 
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
  gemspec
data/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # Simple Auth
2
2
 
3
- [![Build Status](https://travis-ci.org/fnando/simple_auth.svg)](https://travis-ci.org/fnando/simple_auth)
4
- [![Code Climate](https://codeclimate.com/github/fnando/simple_auth.png)](https://codeclimate.com/github/fnando/simple_auth)
5
- [![Gem Version](https://badge.fury.io/rb/simple_auth.svg)](http://badge.fury.io/rb/simple_auth)
3
+ [![Travis-CI](https://travis-ci.org/fnando/simple_auth.svg)](https://travis-ci.org/fnando/simple_auth)
4
+ [![Code Climate](https://codeclimate.com/github/fnando/simple_auth/badges/gpa.svg)](https://codeclimate.com/github/fnando/simple_auth)
5
+ [![Test Coverage](https://codeclimate.com/github/fnando/simple_auth/badges/coverage.svg)](https://codeclimate.com/github/fnando/simple_auth/coverage)
6
+ [![Gem](https://img.shields.io/gem/v/simple_auth.svg)](https://rubygems.org/gems/simple_auth)
7
+ [![Gem](https://img.shields.io/gem/dt/simple_auth.svg)](https://rubygems.org/gems/simple_auth)
6
8
 
7
- SimpleAuth is an authentication library to be used when everything else is just too complicated.
9
+ SimpleAuth is an authentication library to be used when everything else is just
10
+ too complicated.
8
11
 
9
- This library only handles session. You have to implement the authentication strategy as you want (e.g. in-site authentication, OAuth, etc).
10
-
11
- Rails 4.2+ running over Ruby 2.1+ is required.
12
+ This library only handles session. You have to implement the authentication
13
+ strategy as you want (e.g. in-site authentication, OAuth, etc).
12
14
 
13
15
  ## Installation
14
16
 
@@ -20,7 +22,9 @@ Then run `rails generate simple_auth:install` to copy the initializer file.
20
22
 
21
23
  ## Usage
22
24
 
23
- The initializer will install the required helper methods on your controller. So, let's say you want to support `user` and `admin` authentication. You'll need to specify the following scope.
25
+ The initializer will install the required helper methods on your controller. So,
26
+ let's say you want to support `user` and `admin` authentication. You'll need to
27
+ specify the following scope.
24
28
 
25
29
  ```ruby
26
30
  # config/initializers/simple_auth.rb
@@ -33,7 +37,10 @@ SimpleAuth.setup do |config|
33
37
  end
34
38
  ```
35
39
 
36
- Session is valid only when `Controller#authorized_#{scope}?` method returns `true`, which is the default behavior. You can override these methods with your own rules; the following example shows how you can authorize all e-mails from `@example.com` to access the admin dashboard.
40
+ Session is valid only when `Controller#authorized_#{scope}?` method returns
41
+ `true`, which is the default behavior. You can override these methods with your
42
+ own rules; the following example shows how you can authorize all e-mails from
43
+ `@example.com` to access the admin dashboard.
37
44
 
38
45
  ```ruby
39
46
  class Admin::DashboardController < ApplicationController
@@ -70,11 +77,33 @@ class SessionsController < ApplicationController
70
77
  end
71
78
  ```
72
79
 
73
- First thing to notice is that simple_auth doesn't care about how you authenticate. You could easily set up a different authentication strategy, e.g. API tokens. The important part is assign the `record:` and `scope:` options. The `return_to` helper will give you the requested url (before the user logged in) or the default url.
80
+ First thing to notice is that SimpleAuth doesn't care about how you
81
+ authenticate. You could easily set up a different authentication strategy, e.g.
82
+ API tokens. The important part is assigning the `record:` and `scope:` options.
83
+ The `return_to` helper will give you the requested url (before the user logged
84
+ in) or the default url.
85
+
86
+ SimpleAuth uses [GlobalID](https://github.com/rails/globalid) as the session
87
+ identifier. This allows using any objects that respond to `#to_gid`, including
88
+ namespaced models and POROs.
89
+
90
+ ```ruby
91
+ session[:user_id]
92
+ #=> gid://myapp/User/1
93
+ ```
94
+
95
+ If you need to locate a record using such value, you can do it by calling
96
+ `GlobalID::Locator.locate(session[:user_id])`
97
+
98
+ ### Logging out users
99
+
100
+ Logging out a user is just as simple; all you have to do is calling the regular
101
+ `reset_session`.
74
102
 
75
- Same thing applies to destroying a session. You can just reset it, calling `reset_session`.
103
+ ### Restricting access
76
104
 
77
- You can restrict access by using 2 macros. Use `redirect_logged_#{scope}` to avoid rendering a page for logged user.
105
+ You can restrict access by using 2 macros. Use `redirect_logged_#{scope}` to
106
+ avoid rendering a page for logged user.
78
107
 
79
108
  ```ruby
80
109
  class SignupController < ApplicationController
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
3
5
 
@@ -7,4 +9,4 @@ Rake::TestTask.new(:test) do |t|
7
9
  t.test_files = FileList["test/**/*_test.rb"]
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require "bundler/setup"
3
5
  require "pry"
4
6
  Pry.start
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec path: ".."
5
+
6
+ gem "rails", "~> 5.2.0"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec path: ".."
5
+
6
+ gem "rails", "~> 6.0.0"
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
4
  require "rails/railtie"
5
+ require "global_id/railtie"
3
6
  require "active_support/concern"
4
7
 
5
8
  require "simple_auth/version"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SimpleAuth
3
4
  module ActionController
4
5
  extend ActiveSupport::Concern
@@ -15,7 +16,7 @@ module SimpleAuth
15
16
  end
16
17
  end
17
18
 
18
- def install_simple_auth_scope(scope)
19
+ def install_simple_auth_scope(scope) # rubocop:disable Metrics/MethodLength
19
20
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
20
21
  def #{scope}_session
21
22
  @#{scope}_session ||= Session.create(scope: :#{scope}, session: session)
@@ -44,17 +45,15 @@ module SimpleAuth
44
45
  end
45
46
  end
46
47
 
47
- private
48
-
49
- def simple_auth
48
+ private def simple_auth
50
49
  @simple_auth ||= SimpleAuth.config
51
50
  end
52
51
 
53
- def return_to(url)
52
+ private def return_to(url)
54
53
  session[:return_to] || url
55
54
  end
56
55
 
57
- def simple_auth_require_logged_scope(scope)
56
+ private def simple_auth_require_logged_scope(scope)
58
57
  action = RequireLoginAction.new(self, scope)
59
58
  return if action.valid?
60
59
 
@@ -64,7 +63,7 @@ module SimpleAuth
64
63
  redirect_to instance_eval(&simple_auth.login_url)
65
64
  end
66
65
 
67
- def simple_auth_redirect_logged_scope(scope)
66
+ private def simple_auth_redirect_logged_scope(scope)
68
67
  scope_session = send("#{scope}_session")
69
68
  return unless scope_session.valid?
70
69
 
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
4
  module ActionController
3
5
  class RequireLoginAction
4
6
  DEFAULT_UNLOGGED_IN_MESSAGE = "You must be logged in to access this page."
5
- DEFAULT_UNAUTHORIZED_MESSAGE = "You don't have permission to access this page."
7
+ DEFAULT_UNAUTHORIZED_MESSAGE =
8
+ "You don't have permission to access this page."
6
9
 
7
10
  attr_reader :controller, :scope
8
11
 
@@ -16,30 +19,29 @@ module SimpleAuth
16
19
  end
17
20
 
18
21
  def message
19
- return nil if valid?
22
+ return if valid?
20
23
  return unauthorized_message unless authorized?
24
+
21
25
  unlogged_message
22
26
  end
23
27
 
24
- private
25
-
26
- def valid_session?
28
+ private def valid_session?
27
29
  controller.send("#{scope}_session").valid?
28
30
  end
29
31
 
30
- def authorized?
32
+ private def authorized?
31
33
  controller.send("authorized_#{scope}?")
32
34
  end
33
35
 
34
- def unauthorized_message
36
+ private def unauthorized_message
35
37
  translation_for("#{scope}.unauthorized", DEFAULT_UNAUTHORIZED_MESSAGE)
36
38
  end
37
39
 
38
- def unlogged_message
40
+ private def unlogged_message
39
41
  translation_for("#{scope}.unlogged_in", DEFAULT_UNLOGGED_IN_MESSAGE)
40
42
  end
41
43
 
42
- def translation_for(translation_scope, default_message)
44
+ private def translation_for(translation_scope, default_message)
43
45
  I18n.t(translation_scope, scope: :simple_auth, default: default_message)
44
46
  end
45
47
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
4
  class Config
3
5
  # Set which scopes will be activated.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rails/generators"
2
4
 
3
5
  module SimpleAuth
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
4
  class Railtie < Rails::Railtie
3
5
  generators do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
4
  class Session
3
5
  def self.create(**kwargs)
@@ -11,17 +13,14 @@ module SimpleAuth
11
13
  end
12
14
 
13
15
  def record=(record)
14
- @session[record_key] = record.try(:id)
16
+ @session[record_key] = record ? record.to_gid.to_s : nil
15
17
  @record = record
16
18
  end
17
19
 
18
20
  def record
19
- @record ||= record_class
20
- .find_by_id(record_id_from_session) if record_id_from_session
21
- end
21
+ return unless record_id_from_session
22
22
 
23
- def record_class
24
- @record_class ||= Object.const_get(:"#{@scope.to_s.camelize}")
23
+ @record ||= GlobalID::Locator.locate(record_id_from_session)
25
24
  end
26
25
 
27
26
  def record_key
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SimpleAuth.setup do |config|
2
4
  # Define with scopes will be installed.
3
5
  # This can be useful if you want to have separated sessions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleAuth
2
- VERSION = "3.0.0"
4
+ VERSION = "3.1.0"
3
5
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "./lib/simple_auth/version"
2
4
 
3
5
  Gem::Specification.new do |s|
4
- s.required_ruby_version = ">= 2.2.0"
5
6
  s.name = "simple_auth"
6
7
  s.version = SimpleAuth::VERSION
7
8
  s.platform = Gem::Platform::RUBY
@@ -13,14 +14,20 @@ Gem::Specification.new do |s|
13
14
 
14
15
  s.files = `git ls-files`.split("\n")
15
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.executables = `git ls-files -- bin/*`
18
+ .split("\n")
19
+ .map {|f| File.basename(f) }
17
20
  s.require_paths = ["lib"]
18
21
 
19
- s.add_dependency "rails", ">= 4.2.0"
20
- s.add_development_dependency "sqlite3-ruby"
22
+ s.add_dependency "globalid"
23
+ s.add_dependency "rails"
21
24
  s.add_development_dependency "activerecord"
25
+ s.add_development_dependency "bcrypt", "~> 3.1.7"
22
26
  s.add_development_dependency "minitest"
23
27
  s.add_development_dependency "minitest-utils"
24
- s.add_development_dependency "bcrypt", "~> 3.1.7"
25
28
  s.add_development_dependency "pry-meta"
29
+ s.add_development_dependency "rubocop"
30
+ s.add_development_dependency "rubocop-fnando"
31
+ s.add_development_dependency "simplecov"
32
+ s.add_development_dependency "sqlite3"
26
33
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class AdminDashboardControllerTest < ActionController::TestCase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class DashboardControllerTest < ActionController::TestCase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class PagesControllerTest < ActionController::TestCase
@@ -6,11 +8,29 @@ class PagesControllerTest < ActionController::TestCase
6
8
  @controller.reset_session
7
9
 
8
10
  User.delete_all
9
- User.create!(password: "test", email: "john@example.com")
10
11
  end
11
12
 
12
13
  test "sets flash message while redirecting unlogged user" do
13
14
  get :index
14
15
  assert_equal "You must be logged in to access this page.", flash[:alert]
15
16
  end
17
+
18
+ test "redirects to login url" do
19
+ get :index
20
+
21
+ assert_redirected_to login_path
22
+ end
23
+
24
+ test "redirects to requested url" do
25
+ get :index
26
+ assert_redirected_to login_path
27
+
28
+ get :log_in
29
+ assert_redirected_to controller: :pages, action: :index
30
+ end
31
+
32
+ test "redirects to default url" do
33
+ get :log_in
34
+ assert_redirected_to controller: :pages, action: :logged_area
35
+ end
16
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "test_helper"
2
4
 
3
5
  class InstallTest < Rails::Generators::TestCase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../application_controller"
2
4
 
3
5
  module Admin
@@ -26,9 +28,7 @@ module Admin
26
28
  head :ok
27
29
  end
28
30
 
29
- private
30
-
31
- def authorized?
31
+ private def authorized?
32
32
  current_admin.present? || current_user.admin?
33
33
  end
34
34
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ApplicationController < ActionController::Base
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DashboardController < ApplicationController
2
4
  before_action :require_logged_user, except: %w[log_in not_logged]
3
5
  before_action :redirect_logged_user, only: "not_logged"
@@ -15,9 +17,7 @@ class DashboardController < ApplicationController
15
17
  head :ok
16
18
  end
17
19
 
18
- private
19
-
20
- def authorized_user?
20
+ private def authorized_user?
21
21
  current_user.try(:email).to_s.match(/@example.com\z/)
22
22
  end
23
23
  end
@@ -1,7 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class PagesController < ApplicationController
2
- before_action :require_logged_user
4
+ before_action :require_logged_user, except: :log_in
3
5
 
4
6
  def index
5
7
  head :ok
6
8
  end
9
+
10
+ def logged_area
11
+ head :ok
12
+ end
13
+
14
+ def log_in
15
+ user_session.record = User.first
16
+ redirect_to return_to(pages_logged_area_path)
17
+ end
7
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ActiveRecord::Base
2
4
  has_secure_password
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ENV["RAILS_ENV"] = "test"
2
4
 
3
5
  require "rails"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SimpleAuth.setup do |config|
2
4
  # Define with scopes will be installed.
3
5
  # This can be useful if you want to have separated sessions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
4
  get "/dashboard", to: "dashboard#index"
3
5
  get "/admin/dashboard", to: "admin/dashboard#index"
@@ -10,6 +12,8 @@ Rails.application.routes.draw do
10
12
 
11
13
  controller :pages do
12
14
  get :index
15
+ get :log_in
16
+ get :logged_area, as: "pages_logged_area"
13
17
  end
14
18
 
15
19
  namespace :admin do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveRecord::Schema.define(version: 0) do
2
4
  create_table :users do |t|
3
5
  t.string :email, :password_digest, :username
@@ -1,4 +1,7 @@
1
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+ SimpleCov.start
2
5
 
3
6
  require "bundler/setup"
4
7
  require "rack/test"
@@ -7,6 +10,7 @@ require "minitest/autorun"
7
10
 
8
11
  require "./test/support/dummy/config/application"
9
12
  require "./test/support/dummy/config/routes"
13
+ require "./test/support/dummy/app/controllers/application_controller"
10
14
 
11
15
  require "active_record"
12
16
  ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
metadata CHANGED
@@ -1,37 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2020-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: globalid
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sqlite3-ruby
28
+ name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bcrypt
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.7
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.7
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,21 +95,63 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: bcrypt
98
+ name: pry-meta
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 3.1.7
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 3.1.7
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: pry-meta
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-fnando
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
99
155
  requirement: !ruby/object:Gem::Requirement
100
156
  requirements:
101
157
  - - ">="
@@ -117,6 +173,7 @@ extensions: []
117
173
  extra_rdoc_files: []
118
174
  files:
119
175
  - ".gitignore"
176
+ - ".rubocop.yml"
120
177
  - ".travis.yml"
121
178
  - CHANGELOG.md
122
179
  - Gemfile
@@ -124,8 +181,8 @@ files:
124
181
  - README.md
125
182
  - Rakefile
126
183
  - bin/console
127
- - gemfiles/rails_4_2.gemfile
128
- - gemfiles/rails_5_0.gemfile
184
+ - gemfiles/rails_5_2.gemfile
185
+ - gemfiles/rails_6_0.gemfile
129
186
  - lib/simple_auth.rb
130
187
  - lib/simple_auth/action_controller.rb
131
188
  - lib/simple_auth/action_controller/require_login_action.rb
@@ -161,15 +218,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
218
  requirements:
162
219
  - - ">="
163
220
  - !ruby/object:Gem::Version
164
- version: 2.2.0
221
+ version: '0'
165
222
  required_rubygems_version: !ruby/object:Gem::Requirement
166
223
  requirements:
167
224
  - - ">="
168
225
  - !ruby/object:Gem::Version
169
226
  version: '0'
170
227
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.5.1
228
+ rubygems_version: 3.1.2
173
229
  signing_key:
174
230
  specification_version: 4
175
231
  summary: A simple authentication system for Rails apps
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec path: ".."
3
-
4
- gem "rails", "~> 4.2.4"
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec path: ".."
3
-
4
- gem "rails", github: "rails/rails"