rails-session_cookie 0.2.2 → 0.3.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/branch.yml +45 -0
- data/.github/workflows/ci.yml +50 -0
- data/.gitignore +1 -2
- data/.rubocop.yml +20 -2
- data/Appraisals +42 -18
- data/Gemfile +28 -1
- data/LICENSE +21 -0
- data/README.md +35 -16
- data/Rakefile +7 -26
- data/bin/console +1 -0
- data/gemfiles/rails_5.2.gemfile +22 -0
- data/gemfiles/rails_5.2_warden.gemfile +24 -0
- data/gemfiles/rails_6.0.gemfile +22 -0
- data/gemfiles/rails_6.0_warden.gemfile +24 -0
- data/gemfiles/rails_6.1.gemfile +22 -0
- data/gemfiles/rails_6.1_warden.gemfile +24 -0
- data/gemfiles/rails_7.0.gemfile +22 -0
- data/gemfiles/rails_7.0_warden.gemfile +24 -0
- data/lib/rails/session_cookie/app.rb +5 -3
- data/lib/rails/session_cookie/env.rb +40 -0
- data/lib/rails/session_cookie/version.rb +3 -1
- data/lib/rails/session_cookie/warden_app.rb +5 -3
- data/lib/rails/session_cookie.rb +4 -1
- data/rails-session_cookie.gemspec +2 -17
- metadata +18 -188
- data/.travis.yml +0 -15
- data/gemfiles/rails_4.2.gemfile +0 -8
- data/gemfiles/rails_4.2.gemfile.lock +0 -204
- data/gemfiles/rails_4.2_warden.gemfile +0 -10
- data/gemfiles/rails_4.2_warden.gemfile.lock +0 -219
- data/gemfiles/rails_5.0.gemfile +0 -8
- data/gemfiles/rails_5.0.gemfile.lock +0 -210
- data/gemfiles/rails_5.0_warden.gemfile +0 -10
- data/gemfiles/rails_5.0_warden.gemfile.lock +0 -225
- data/gemfiles/rails_5.1.gemfile +0 -8
- data/gemfiles/rails_5.1.gemfile.lock +0 -210
- data/gemfiles/rails_5.1_warden.gemfile +0 -10
- data/gemfiles/rails_5.1_warden.gemfile.lock +0 -225
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 710f09ff0bcd2904b3553ae18b55d2951343ea28a4a3d8d75cb7abaef2a6d45f
|
4
|
+
data.tar.gz: 11bd83b9cb85e58618f0c8d7d9e11b95578d20d5041645ad86e03511e70c9245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3468e309eceaf7cf1d76274e4172b552c013e563b633fa74d5414f36e839f0cb71b6a9ea9c91418061ae2a6988c9d2ef683586233ae8301c1ba18a71a3d5fa
|
7
|
+
data.tar.gz: 0fb49d0514c5036353548656ccb2dbb88c0d6b5b959fca79a331f8c8befd9a600fbfff7400951e35d93c6cd408f0db04f6f593ae3dd7a6dbd57af4f56ffac66b
|
@@ -0,0 +1,45 @@
|
|
1
|
+
name: branch
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches-ignore:
|
5
|
+
- master
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
|
12
|
+
gemfile: [ 'gemfiles/rails_5.2.gemfile', 'gemfiles/rails_5.2_warden.gemfile', 'gemfiles/rails_6.0.gemfile', 'gemfiles/rails_6.0_warden.gemfile', 'gemfiles/rails_6.1.gemfile', 'gemfiles/rails_6.1_warden.gemfile', 'gemfiles/rails_7.0.gemfile', 'gemfiles/rails_7.0_warden.gemfile' ]
|
13
|
+
exclude:
|
14
|
+
- ruby: '2.6'
|
15
|
+
gemfile: 'gemfiles/rails_7.0.gemfile'
|
16
|
+
- ruby: '2.6'
|
17
|
+
gemfile: 'gemfiles/rails_7.0_warden.gemfile'
|
18
|
+
- ruby: '3.0'
|
19
|
+
gemfile: 'gemfiles/rails_5.2.gemfile'
|
20
|
+
- ruby: '3.0'
|
21
|
+
gemfile: 'gemfiles/rails_5.2_warden.gemfile'
|
22
|
+
- ruby: '3.1'
|
23
|
+
gemfile: 'gemfiles/rails_5.2.gemfile'
|
24
|
+
- ruby: '3.1'
|
25
|
+
gemfile: 'gemfiles/rails_5.2_warden.gemfile'
|
26
|
+
name: Ruby ${{ matrix.ruby }}, Gemfile ${{ matrix.gemfile }}
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- uses: actions/cache@v2
|
33
|
+
with:
|
34
|
+
path: vendor/bundle
|
35
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('Gemfile', 'gemfiles/**.gemfile') }}
|
36
|
+
restore-keys: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('Gemfile', 'gemfiles/**.gemfile') }}
|
37
|
+
- name: Test
|
38
|
+
env:
|
39
|
+
CI: true
|
40
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
41
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
42
|
+
run: |
|
43
|
+
bundle config path vendor/bundle
|
44
|
+
bundle install --jobs 4 --retry 3
|
45
|
+
bundle exec rake ci
|
@@ -0,0 +1,50 @@
|
|
1
|
+
name: ci
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
types:
|
5
|
+
- opened
|
6
|
+
- synchronize
|
7
|
+
- reopened
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
|
17
|
+
gemfile: [ 'gemfiles/rails_5.2.gemfile', 'gemfiles/rails_5.2_warden.gemfile', 'gemfiles/rails_6.0.gemfile', 'gemfiles/rails_6.0_warden.gemfile', 'gemfiles/rails_6.1.gemfile', 'gemfiles/rails_6.1_warden.gemfile', 'gemfiles/rails_7.0.gemfile', 'gemfiles/rails_7.0_warden.gemfile' ]
|
18
|
+
exclude:
|
19
|
+
- ruby: '2.6'
|
20
|
+
gemfile: 'gemfiles/rails_7.0.gemfile'
|
21
|
+
- ruby: '2.6'
|
22
|
+
gemfile: 'gemfiles/rails_7.0_warden.gemfile'
|
23
|
+
- ruby: '3.0'
|
24
|
+
gemfile: 'gemfiles/rails_5.2.gemfile'
|
25
|
+
- ruby: '3.0'
|
26
|
+
gemfile: 'gemfiles/rails_5.2_warden.gemfile'
|
27
|
+
- ruby: '3.1'
|
28
|
+
gemfile: 'gemfiles/rails_5.2.gemfile'
|
29
|
+
- ruby: '3.1'
|
30
|
+
gemfile: 'gemfiles/rails_5.2_warden.gemfile'
|
31
|
+
name: Ruby ${{ matrix.ruby }}, Gemfile ${{ matrix.gemfile }}
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
- uses: actions/setup-ruby@v1
|
35
|
+
with:
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
37
|
+
- uses: actions/cache@v2
|
38
|
+
with:
|
39
|
+
path: vendor/bundle
|
40
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('Gemfile', 'gemfiles/**.gemfile') }}
|
41
|
+
restore-keys: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('Gemfile', 'gemfiles/**.gemfile') }}
|
42
|
+
- name: Test
|
43
|
+
env:
|
44
|
+
CI: true
|
45
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
46
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
47
|
+
run: |
|
48
|
+
bundle config path vendor/bundle
|
49
|
+
bundle install --jobs 4 --retry 3
|
50
|
+
bundle exec rake ci
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,30 @@
|
|
1
1
|
AllCops:
|
2
|
+
NewCops: enable
|
2
3
|
Exclude:
|
3
4
|
- 'lib/rails-session_cookie.rb'
|
4
5
|
- 'gemfiles/vendor/**/*'
|
5
|
-
|
6
|
-
Max:
|
6
|
+
Layout/LineLength:
|
7
|
+
Max: 180
|
7
8
|
Style/MultilineBlockChain:
|
8
9
|
Enabled: false
|
9
10
|
Metrics/BlockLength:
|
10
11
|
Enabled: false
|
11
12
|
Lint/AmbiguousBlockAssociation:
|
12
13
|
Enabled: false
|
14
|
+
Style/StringLiterals:
|
15
|
+
Enabled: false
|
16
|
+
Gemspec/OrderedDependencies:
|
17
|
+
Enabled: false
|
18
|
+
Gemspec/RequiredRubyVersion:
|
19
|
+
Enabled: false
|
20
|
+
Style/OptionalBooleanParameter:
|
21
|
+
Enabled: false
|
22
|
+
Style/Documentation:
|
23
|
+
Enabled: false
|
24
|
+
Bundler/OrderedGems:
|
25
|
+
Enabled: false
|
26
|
+
Gemspec/RequireMFA:
|
27
|
+
Enabled: false
|
28
|
+
Style/FrozenStringLiteralComment:
|
29
|
+
Exclude:
|
30
|
+
- 'gemfiles/*'
|
data/Appraisals
CHANGED
@@ -1,32 +1,56 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
WARDEN_VERSION = '>= 1.2'
|
4
|
+
DEVISE_VERSION = '~> 4.8'
|
5
|
+
|
6
|
+
appraise 'rails-5.2' do
|
7
|
+
gem 'rails', '~> 5.2.8'
|
8
|
+
gem 'rspec-rails', '~> 5.1.2'
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'rails-5.2-warden' do
|
12
|
+
gem 'rails', '~> 5.2.8'
|
13
|
+
gem 'rspec-rails', '~> 5.1.2'
|
14
|
+
|
15
|
+
gem 'warden', WARDEN_VERSION
|
16
|
+
gem 'devise', DEVISE_VERSION
|
17
|
+
end
|
18
|
+
|
19
|
+
appraise 'rails-6.0' do
|
20
|
+
gem 'rails', '~> 6.0.5'
|
21
|
+
gem 'rspec-rails', '~> 5.1.2'
|
3
22
|
end
|
4
23
|
|
5
|
-
appraise 'rails-
|
6
|
-
gem 'rails', '~>
|
24
|
+
appraise 'rails-6.0-warden' do
|
25
|
+
gem 'rails', '~> 6.0.5'
|
26
|
+
gem 'rspec-rails', '~> 5.1.2'
|
7
27
|
|
8
|
-
gem 'warden',
|
9
|
-
gem 'devise',
|
28
|
+
gem 'warden', WARDEN_VERSION
|
29
|
+
gem 'devise', DEVISE_VERSION
|
10
30
|
end
|
11
31
|
|
12
|
-
appraise 'rails-
|
13
|
-
gem 'rails', '~>
|
32
|
+
appraise 'rails-6.1' do
|
33
|
+
gem 'rails', '~> 6.1.6'
|
34
|
+
gem 'rspec-rails', '6.0.0.rc1'
|
14
35
|
end
|
15
36
|
|
16
|
-
appraise 'rails-
|
17
|
-
gem 'rails', '~>
|
37
|
+
appraise 'rails-6.1-warden' do
|
38
|
+
gem 'rails', '~> 6.1.6'
|
39
|
+
gem 'rspec-rails', '6.0.0.rc1'
|
18
40
|
|
19
|
-
gem 'warden',
|
20
|
-
gem 'devise',
|
41
|
+
gem 'warden', WARDEN_VERSION
|
42
|
+
gem 'devise', DEVISE_VERSION
|
21
43
|
end
|
22
44
|
|
23
|
-
appraise 'rails-
|
24
|
-
gem 'rails', '~>
|
45
|
+
appraise 'rails-7.0' do
|
46
|
+
gem 'rails', '~> 7.0.3'
|
47
|
+
gem 'rspec-rails', '6.0.0.rc1'
|
25
48
|
end
|
26
49
|
|
27
|
-
appraise 'rails-
|
28
|
-
gem 'rails', '~>
|
50
|
+
appraise 'rails-7.0-warden' do
|
51
|
+
gem 'rails', '~> 7.0.3'
|
52
|
+
gem 'rspec-rails', '6.0.0.rc1'
|
29
53
|
|
30
|
-
gem 'warden',
|
31
|
-
gem 'devise',
|
54
|
+
gem 'warden', WARDEN_VERSION
|
55
|
+
gem 'devise', DEVISE_VERSION
|
32
56
|
end
|
data/Gemfile
CHANGED
@@ -1,7 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
|
-
|
5
|
+
gem 'rspec'
|
6
|
+
gem 'rspec-rails'
|
7
|
+
gem 'rspec-benchmark', '~> 0.3'
|
8
|
+
gem 'rspec-github', '~> 2.3'
|
9
|
+
|
10
|
+
gem 'rubocop', '~> 1.29'
|
11
|
+
gem 'rubocop-rake', '~> 0.6'
|
12
|
+
gem 'rubocop-rspec', '~> 2.10'
|
13
|
+
gem 'rubocop-performance', '~> 1.13'
|
14
|
+
|
15
|
+
gem 'simplecov', '~> 0.21'
|
16
|
+
gem 'codecov', require: false
|
17
|
+
|
18
|
+
# test devise with memory database
|
19
|
+
gem 'devise', '~> 4.8.1' if ENV.fetch('BUNDLE_GEMFILE', nil) =~ /warden/
|
20
|
+
gem 'sqlite3', '~> 1.4'
|
21
|
+
|
22
|
+
# benchmarking test
|
23
|
+
gem 'capybara', '~> 2.15', require: false
|
24
|
+
gem 'benchmark-ips', '~> 2.7', require: false
|
25
|
+
|
26
|
+
# dev
|
27
|
+
gem 'rake'
|
28
|
+
gem 'appraisal', '~> 2.4', require: false
|
4
29
|
|
30
|
+
# be sure to generate gemfiles like
|
31
|
+
# CI=1 bundle exec appraisal generate
|
5
32
|
gem 'pry-byebug' unless ENV['CI']
|
6
33
|
|
7
34
|
# Specify your gem's dependencies in rails-session_cookie.gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Vlad Bokov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -2,10 +2,15 @@
|
|
2
2
|
|
3
3
|
Fast, loosely coupled requests specs for a cookie-authenticated application.
|
4
4
|
|
5
|
-
|
6
|
-
[![
|
7
|
-
[![
|
5
|
+
![](https://github.com/razum2um/rails-session_cookie/workflows/ci/badge.svg)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/rails-session_cookie.svg)](https://badge.fury.io/rb/rails-session_cookie)
|
7
|
+
[![Codecov](https://codecov.io/gh/razum2um/rails-session_cookie/branch/master/graph/badge.svg?token=X5K67X3V0Z)](undefined)
|
8
8
|
|
9
|
+
Key goals:
|
10
|
+
|
11
|
+
- how to login under any user in request tests quickly
|
12
|
+
- how to speed up capybara, selenium tests
|
13
|
+
- how to login under any user in production using rails console
|
9
14
|
## Why
|
10
15
|
|
11
16
|
Probably, you might have seen a lot code like this:
|
@@ -78,7 +83,7 @@ Now you can cache `raw_session_cookie` globally or per-thread depending on `curr
|
|
78
83
|
|
79
84
|
You can also use the `raw_session_cookie` directly like this:
|
80
85
|
|
81
|
-
```
|
86
|
+
```ruby
|
82
87
|
get "/", {}, { "HTTP_COOKIE" => raw_session_cookie }
|
83
88
|
```
|
84
89
|
|
@@ -121,6 +126,30 @@ Capybara.current_session.driver.browser.set_cookie raw_session_cookie
|
|
121
126
|
|
122
127
|
*TODO:* Only tested with `:rack_test` driver!
|
123
128
|
|
129
|
+
## Login under any devise user in rails production
|
130
|
+
|
131
|
+
If you're in production rails console:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
Rails::SessionCookie::WardenApp.new(User.last).session_cookie
|
135
|
+
```
|
136
|
+
|
137
|
+
If you're on remote/developer instance:
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
# take values from production console:
|
141
|
+
secret_key_base = Rails.application.env_config['action_dispatch.secret_key_base']
|
142
|
+
data = User.serialize_into_session(user) # [[user.id], user.encrypted_password[0,29]]
|
143
|
+
opts = Rails.application.config.session_options
|
144
|
+
|
145
|
+
# in remote rails console:
|
146
|
+
key = "warden.user.user.key" # "warden.user.#{scope}.key"
|
147
|
+
Rails::SessionCookie::App.new({ key => data }, opts).session_cookie(secret_key_base: secret_key_base)
|
148
|
+
```
|
149
|
+
|
150
|
+
Then inject the value inside `cookies` in browser devtools.
|
151
|
+
This another friendly reminder, why you need to keep your `SECRET_KEY_BASE` secure!
|
152
|
+
|
124
153
|
## Benchmarks
|
125
154
|
|
126
155
|
*NOTE:* Sometimes devise's `sign_in` is still faster than `SessionCookie` (a little though),
|
@@ -133,6 +162,8 @@ if you understand HTTP session cookies principles.
|
|
133
162
|
|
134
163
|
```sh
|
135
164
|
$ appraisal rails-5.1-warden rspec -t performance spec/benchmarks/feature_spec.rb
|
165
|
+
# or just
|
166
|
+
$ BUNDLE_GEMFILE=gemfiles/rails_6.0_warden.gemfile bundle exec rspec
|
136
167
|
|
137
168
|
Speed using capybara in feature test
|
138
169
|
correctness of
|
@@ -201,15 +232,3 @@ session cookie : 17573.4 i/s
|
|
201
232
|
session cookie (no cache): 4714.3 i/s - 3.73x slower
|
202
233
|
custom sign in : 11.2 i/s - 1566.44x slower
|
203
234
|
```
|
204
|
-
|
205
|
-
## Contributing
|
206
|
-
|
207
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/razum2um/rails-session_cookie.
|
208
|
-
|
209
|
-
[Gem Version]: https://rubygems.org/gems/rails-session_cookie
|
210
|
-
[Build Status]: https://travis-ci.org/razum2um/rails-session_cookie
|
211
|
-
[Coverage]: https://codeclimate.com/github/razum2um/rails-session_cookie/coverage
|
212
|
-
|
213
|
-
[GV img]: https://badge.fury.io/rb/rails-session_cookie.svg
|
214
|
-
[BS img]: https://travis-ci.org/razum2um/rails-session_cookie.png
|
215
|
-
[CV img]: https://codeclimate.com/github/razum2um/rails-session_cookie/badges/coverage.svg
|
data/Rakefile
CHANGED
@@ -1,34 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
require 'rubocop/rake_task'
|
4
|
-
require 'codeclimate-test-reporter'
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
RuboCop::RakeTask.new
|
8
|
-
|
9
|
-
# Same as bin/codeclimate-test-reporter, but don't complain if no coverage found
|
10
|
-
task :coverage do
|
11
|
-
exit unless ENV['CI']
|
12
|
-
|
13
|
-
repo_token = ENV['CODECLIMATE_REPO_TOKEN']
|
14
|
-
if repo_token.nil? || repo_token.empty?
|
15
|
-
STDERR.puts 'Cannot post results: environment variable CODECLIMATE_REPO_TOKEN must be set.'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
|
19
|
-
COVERAGE_FILE = ARGV.first || 'coverage/.resultset.json'
|
20
|
-
unless File.exist?(COVERAGE_FILE)
|
21
|
-
STDERR.puts 'Coverage results not found'
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
results = JSON.parse(File.read(COVERAGE_FILE))
|
27
|
-
rescue JSON::ParserError => e
|
28
|
-
abort "Error encountered while parsing #{COVERAGE_FILE}: #{e}"
|
29
|
-
end
|
8
|
+
RuboCop::RakeTask.new
|
30
9
|
|
31
|
-
|
10
|
+
RSpec::Core::RakeTask.new(:spec_github) do |t|
|
11
|
+
t.rspec_opts = '--format RSpec::Github::Formatter -f documentation'
|
32
12
|
end
|
33
13
|
|
34
|
-
task
|
14
|
+
task ci: %i[rubocop spec_github]
|
15
|
+
task default: %i[rubocop spec]
|
data/bin/console
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "~> 5.1.2"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 5.2.8"
|
21
|
+
|
22
|
+
gemspec path: "../"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "~> 5.1.2"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 5.2.8"
|
21
|
+
gem "warden", ">= 1.2"
|
22
|
+
gem "devise", "~> 4.8"
|
23
|
+
|
24
|
+
gemspec path: "../"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "~> 5.1.2"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 6.0.5"
|
21
|
+
|
22
|
+
gemspec path: "../"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "~> 5.1.2"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 6.0.5"
|
21
|
+
gem "warden", ">= 1.2"
|
22
|
+
gem "devise", "~> 4.8"
|
23
|
+
|
24
|
+
gemspec path: "../"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "6.0.0.rc1"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 6.1.6"
|
21
|
+
|
22
|
+
gemspec path: "../"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "6.0.0.rc1"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 6.1.6"
|
21
|
+
gem "warden", ">= 1.2"
|
22
|
+
gem "devise", "~> 4.8"
|
23
|
+
|
24
|
+
gemspec path: "../"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "6.0.0.rc1"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 7.0.3"
|
21
|
+
|
22
|
+
gemspec path: "../"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rspec"
|
6
|
+
gem "rspec-rails", "6.0.0.rc1"
|
7
|
+
gem "rspec-benchmark", "~> 0.3"
|
8
|
+
gem "rspec-github", "~> 2.3"
|
9
|
+
gem "rubocop", "~> 1.29"
|
10
|
+
gem "rubocop-rake", "~> 0.6"
|
11
|
+
gem "rubocop-rspec", "~> 2.10"
|
12
|
+
gem "rubocop-performance", "~> 1.13"
|
13
|
+
gem "simplecov", "~> 0.21"
|
14
|
+
gem "codecov", require: false
|
15
|
+
gem "sqlite3", "~> 1.4"
|
16
|
+
gem "capybara", "~> 2.15", require: false
|
17
|
+
gem "benchmark-ips", "~> 2.7", require: false
|
18
|
+
gem "rake"
|
19
|
+
gem "appraisal", "~> 2.4", require: false
|
20
|
+
gem "rails", "~> 7.0.3"
|
21
|
+
gem "warden", ">= 1.2"
|
22
|
+
gem "devise", "~> 4.8"
|
23
|
+
|
24
|
+
gemspec path: "../"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'action_dispatch'
|
2
4
|
|
3
5
|
module Rails
|
@@ -20,7 +22,7 @@ module Rails
|
|
20
22
|
}
|
21
23
|
end
|
22
24
|
|
23
|
-
attr_reader :app
|
25
|
+
attr_reader :app
|
24
26
|
|
25
27
|
def initialize(app, session_options = nil)
|
26
28
|
auth_session_options = session_options || rails_app.config.session_options
|
@@ -35,7 +37,7 @@ module Rails
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def call(env = {})
|
38
|
-
app.call(default_env.merge(env).dup)
|
40
|
+
app.call(default_env.merge(Env.new(env).env).dup)
|
39
41
|
end
|
40
42
|
|
41
43
|
def session_cookie(env = {})
|
@@ -58,7 +60,7 @@ module Rails
|
|
58
60
|
end
|
59
61
|
|
60
62
|
def rails_app
|
61
|
-
@rails_app ||= defined?(Rails) && Rails.application || raise(NoRailsApplication)
|
63
|
+
@rails_app ||= (defined?(Rails) && Rails.application) || raise(NoRailsApplication)
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|