frikandel 3.0.2 → 4.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +18 -37
- data/Appraisals +15 -0
- data/README.md +8 -6
- data/frikandel.gemspec +3 -9
- data/gemfiles/rails_7.2.gemfile +7 -0
- data/gemfiles/rails_8.0.gemfile +7 -0
- data/gemfiles/rails_8.1.gemfile +7 -0
- data/gemfiles/rails_head.gemfile +7 -0
- data/lib/frikandel/bind_session_to_ip_address.rb +1 -5
- data/lib/frikandel/limit_session_lifetime.rb +1 -5
- data/lib/frikandel/version.rb +1 -1
- data/spec/controllers/bind_session_to_ip_address_controller_spec.rb +2 -10
- data/spec/controllers/combined_controller_spec.rb +2 -10
- data/spec/controllers/limit_session_lifetime_controller_spec.rb +2 -10
- data/spec/dummy/app/views/layouts/application.html.erb +1 -5
- data/spec/dummy/config/application.rb +5 -18
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -22
- data/spec/dummy/config/environments/production.rb +3 -71
- data/spec/dummy/config/environments/test.rb +4 -28
- data/spec/rails_helper.rb +4 -50
- data/spec/support/application_controller.rb +1 -6
- metadata +14 -105
- data/gemfiles/rails-5.2.x.gemfile +0 -6
- data/gemfiles/rails-6.0.x.gemfile +0 -6
- data/gemfiles/rails-6.1.x.gemfile +0 -6
- data/gemfiles/rails-7.0.x.gemfile +0 -7
- data/gemfiles/rails-head.gemfile +0 -6
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/app/assets/config/manifest.js +0 -3
- 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/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/test.log +0 -1469
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cff69b9b86ae896c8ba21d0fc1631bd1068f995da1e047d8601f3eb0e8eeca89
|
|
4
|
+
data.tar.gz: 894d018d70cbe303e5b41faf17527557ecc9f434c15b2d361921fc1952a6d82d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b8933fe59102ddcc724f081fa5406a0ab1d036b8da7001cbf891c29cb05021815c57ea56d2c0a92860ab7ec5b4b99f52c0857f2cd29b77e6ab32b9930ea493b
|
|
7
|
+
data.tar.gz: 29cd07195aafcb9830a48ed64053cf6cf633b9e700541ee88f276607c50def9b5ba3552f77df146857c9a88b097c8c8df37ee8ad96d6ea26946a5e6175ce425a
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -17,47 +17,28 @@ on:
|
|
|
17
17
|
|
|
18
18
|
jobs:
|
|
19
19
|
test:
|
|
20
|
-
|
|
21
20
|
runs-on: ubuntu-latest
|
|
22
21
|
strategy:
|
|
23
22
|
fail-fast: false
|
|
24
23
|
matrix:
|
|
25
|
-
ruby-version: ['2
|
|
26
|
-
gemfile: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- ruby-version: '
|
|
30
|
-
gemfile:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- ruby-version: '3.1'
|
|
35
|
-
gemfile: rails-5.2.x
|
|
36
|
-
- ruby-version: '3.1'
|
|
37
|
-
gemfile: rails-6.0.x
|
|
38
|
-
- ruby-version: '3.1'
|
|
39
|
-
gemfile: rails-6.1.x
|
|
40
|
-
# ruby < 2.7 is not compatible with rails 7
|
|
41
|
-
- ruby-version: '2.6'
|
|
42
|
-
gemfile: rails-7.0.x
|
|
43
|
-
# jruby is not compatible with rails 7 (yet)
|
|
44
|
-
- ruby-version: 'jruby'
|
|
45
|
-
gemfile: rails-7.0.x
|
|
46
|
-
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
|
24
|
+
ruby-version: ['3.2', '3.3', '3.4', '4.0']
|
|
25
|
+
gemfile: ['rails_7.2', 'rails_8.0', 'rails_8.1']
|
|
26
|
+
experimental: [false]
|
|
27
|
+
include:
|
|
28
|
+
- ruby-version: '4.0'
|
|
29
|
+
gemfile: 'rails_head'
|
|
30
|
+
experimental: true
|
|
31
|
+
continue-on-error: ${{ matrix.experimental }}
|
|
32
|
+
env:
|
|
47
33
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
|
48
|
-
|
|
49
34
|
name: test (ruby ${{ matrix.ruby-version }}, ${{ matrix.gemfile }})
|
|
50
|
-
|
|
51
35
|
steps:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
62
|
-
- name: Run tests
|
|
63
|
-
run: bundle exec rake
|
|
36
|
+
- name: Checkout
|
|
37
|
+
uses: actions/checkout@v4
|
|
38
|
+
- name: Set up Ruby
|
|
39
|
+
uses: ruby/setup-ruby@v1
|
|
40
|
+
with:
|
|
41
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
42
|
+
bundler-cache: true
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: bundle exec rake
|
data/Appraisals
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
appraise "rails-7.2" do
|
|
2
|
+
gem "rails", "~> 7.2.0"
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
appraise "rails-8.0" do
|
|
6
|
+
gem "rails", "~> 8.0.0"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
appraise "rails-8.1" do
|
|
10
|
+
gem "rails", "~> 8.1.0"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise "rails-head" do
|
|
14
|
+
gem "rails", github: "rails/rails", branch: "main"
|
|
15
|
+
end
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ By adding a TTL the attack window gets smaller. An stolen has to be used within
|
|
|
16
16
|
|
|
17
17
|
## Requirements
|
|
18
18
|
|
|
19
|
-
Rails
|
|
19
|
+
Rails 7.2 and newer are supported, on Ruby 3.2 and newer.
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
@@ -91,6 +91,8 @@ end
|
|
|
91
91
|
|
|
92
92
|
## Changes
|
|
93
93
|
|
|
94
|
+
* v4.0.0 -- Drop support for Rails < 7.2 and Ruby < 3.2, add support for Rails 7.2, 8.0 and 8.1, rebuild the test suite (RSpec + Appraisal, no ActiveRecord)
|
|
95
|
+
* v3.0.2 -- Add support for Ruby 3.1 and add DevContainer setup for development
|
|
94
96
|
* v3.0.1 -- Add support for Rails v7.x
|
|
95
97
|
* v3.0.0 -- Drop support for Rails < v5.2, add support for Rails v6.1 and switch from TravisCI to GithubActions
|
|
96
98
|
* v2.3.0 -- Add support for Rails v5.1 and Rails v6.0 and fix TravisCI builds
|
|
@@ -102,11 +104,11 @@ end
|
|
|
102
104
|
|
|
103
105
|
To run the test suite with different rails version by selecting the corresponding gemfile. You can use these one liners:
|
|
104
106
|
|
|
105
|
-
$
|
|
106
|
-
$
|
|
107
|
-
$
|
|
108
|
-
$
|
|
109
|
-
$
|
|
107
|
+
$ bundle exec appraisal install
|
|
108
|
+
$ bundle exec appraisal rails-7.2 rake
|
|
109
|
+
$ bundle exec appraisal rails-8.0 rake
|
|
110
|
+
$ bundle exec appraisal rails-8.1 rake
|
|
111
|
+
$ bundle exec appraisal rails-head rake
|
|
110
112
|
|
|
111
113
|
## Contributing
|
|
112
114
|
1. Fork it
|
data/frikandel.gemspec
CHANGED
|
@@ -16,21 +16,15 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
-
spec.test_files = Dir["spec/**/*"]
|
|
20
19
|
spec.require_paths = ["lib"]
|
|
21
20
|
|
|
22
|
-
spec.required_ruby_version
|
|
23
|
-
spec.required_rubygems_version = ">= 1.3.6"
|
|
21
|
+
spec.required_ruby_version = '>= 3.2'
|
|
24
22
|
|
|
25
23
|
spec.add_development_dependency "bundler"
|
|
26
24
|
spec.add_development_dependency "rake"
|
|
27
|
-
spec.add_development_dependency "sqlite3" unless RUBY_PLATFORM == 'java'
|
|
28
|
-
spec.add_development_dependency "jdbc-sqlite3" if RUBY_PLATFORM == 'java'
|
|
29
|
-
spec.add_development_dependency "activerecord-jdbcsqlite3-adapter" if RUBY_PLATFORM == 'java'
|
|
30
25
|
spec.add_development_dependency "rspec-rails", "> 3.0"
|
|
31
|
-
spec.add_development_dependency "
|
|
26
|
+
spec.add_development_dependency "appraisal"
|
|
32
27
|
spec.add_development_dependency "pry"
|
|
33
|
-
spec.add_development_dependency "test-unit"
|
|
34
28
|
|
|
35
|
-
spec.add_dependency "rails", ">=
|
|
29
|
+
spec.add_dependency "rails", ">= 7.2"
|
|
36
30
|
end
|
|
@@ -4,11 +4,7 @@ module Frikandel
|
|
|
4
4
|
include SessionInvalidation
|
|
5
5
|
|
|
6
6
|
included do
|
|
7
|
-
|
|
8
|
-
append_before_action :validate_session_ip_address
|
|
9
|
-
else
|
|
10
|
-
append_before_filter :validate_session_ip_address
|
|
11
|
-
end
|
|
7
|
+
append_before_action :validate_session_ip_address
|
|
12
8
|
end
|
|
13
9
|
|
|
14
10
|
private
|
|
@@ -4,11 +4,7 @@ module Frikandel
|
|
|
4
4
|
include SessionInvalidation
|
|
5
5
|
|
|
6
6
|
included do
|
|
7
|
-
|
|
8
|
-
append_before_action :validate_session_timestamp
|
|
9
|
-
else
|
|
10
|
-
append_before_filter :validate_session_timestamp
|
|
11
|
-
end
|
|
7
|
+
append_before_action :validate_session_timestamp
|
|
12
8
|
end
|
|
13
9
|
|
|
14
10
|
private
|
data/lib/frikandel/version.rb
CHANGED
|
@@ -5,18 +5,10 @@ require "support/application_controller"
|
|
|
5
5
|
class BindSessionToIpAddressController < ApplicationController
|
|
6
6
|
include Frikandel::BindSessionToIpAddress
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
10
|
-
else
|
|
11
|
-
before_filter :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
12
|
-
end
|
|
8
|
+
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
13
9
|
|
|
14
10
|
def home
|
|
15
|
-
|
|
16
|
-
render plain: "bind test"
|
|
17
|
-
else
|
|
18
|
-
render text: "bind test"
|
|
19
|
-
end
|
|
11
|
+
render plain: "bind test"
|
|
20
12
|
end
|
|
21
13
|
|
|
22
14
|
def redirect_home
|
|
@@ -6,18 +6,10 @@ class CombinedController < ApplicationController
|
|
|
6
6
|
include Frikandel::LimitSessionLifetime
|
|
7
7
|
include Frikandel::BindSessionToIpAddress
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
11
|
-
else
|
|
12
|
-
before_filter :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
13
|
-
end
|
|
9
|
+
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
14
10
|
|
|
15
11
|
def home
|
|
16
|
-
|
|
17
|
-
render plain: "combined test"
|
|
18
|
-
else
|
|
19
|
-
render text: "combined test"
|
|
20
|
-
end
|
|
12
|
+
render plain: "combined test"
|
|
21
13
|
end
|
|
22
14
|
|
|
23
15
|
def redirect_home
|
|
@@ -5,18 +5,10 @@ require "support/application_controller"
|
|
|
5
5
|
class LimitSessionLifetimeController < ApplicationController
|
|
6
6
|
include Frikandel::LimitSessionLifetime
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
10
|
-
else
|
|
11
|
-
before_filter :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
12
|
-
end
|
|
8
|
+
before_action :flash_alert_and_redirect_home, only: [:redirect_home]
|
|
13
9
|
|
|
14
10
|
def home
|
|
15
|
-
|
|
16
|
-
render plain: "ttl test"
|
|
17
|
-
else
|
|
18
|
-
render text: "ttl test"
|
|
19
|
-
end
|
|
11
|
+
render plain: "ttl test"
|
|
20
12
|
end
|
|
21
13
|
|
|
22
14
|
def redirect_home
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<title>Dummy</title>
|
|
5
|
-
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
|
6
|
-
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
7
5
|
<%= csrf_meta_tags %>
|
|
8
6
|
</head>
|
|
9
7
|
<body>
|
|
10
|
-
|
|
11
|
-
<%= yield %>
|
|
12
|
-
|
|
8
|
+
<%= yield %>
|
|
13
9
|
</body>
|
|
14
10
|
</html>
|
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
require "active_record/railtie"
|
|
3
|
+
# Only the frameworks the gem actually needs.
|
|
5
4
|
require "action_controller/railtie"
|
|
6
|
-
require "action_mailer/railtie"
|
|
7
|
-
require "sprockets/railtie"
|
|
8
|
-
# require "rails/test_unit/railtie"
|
|
9
5
|
|
|
10
6
|
Bundler.require(*Rails.groups)
|
|
11
7
|
require "frikandel"
|
|
12
8
|
|
|
13
9
|
module Dummy
|
|
14
|
-
RAILS_GEM_VERSION = Gem::Version.new(Rails::VERSION::STRING).freeze
|
|
15
|
-
|
|
16
10
|
class Application < Rails::Application
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# -- all .rb files in that directory are automatically loaded.
|
|
20
|
-
|
|
21
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
22
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
23
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
|
11
|
+
config.load_defaults "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"
|
|
12
|
+
config.eager_load = false
|
|
24
13
|
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
# config.i18n.default_locale = :de
|
|
14
|
+
# Static secret for the test suite only — not a real credential.
|
|
15
|
+
config.secret_key_base = "dummy_secret_key_base_for_the_frikandel_test_suite_only"
|
|
28
16
|
end
|
|
29
17
|
end
|
|
30
|
-
|
data/spec/dummy/config/boot.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
|
2
2
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
3
3
|
|
|
4
|
-
require 'bundler/setup' if File.
|
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
5
5
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# In the development environment your application's code is reloaded on
|
|
5
|
-
# every request. This slows down response time but is perfect for development
|
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
|
7
|
-
config.cache_classes = false
|
|
8
|
-
|
|
9
|
-
# Do not eager load code on boot.
|
|
2
|
+
config.enable_reloading = true
|
|
10
3
|
config.eager_load = false
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
config.consider_all_requests_local = true
|
|
5
|
+
config.consider_all_requests_local = true
|
|
14
6
|
config.action_controller.perform_caching = false
|
|
15
7
|
|
|
16
|
-
# Don't care if the mailer can't send.
|
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
|
18
|
-
|
|
19
|
-
# Print deprecation notices to the Rails logger.
|
|
20
8
|
config.active_support.deprecation = :log
|
|
21
|
-
|
|
22
|
-
# Raise an error on page load if there are pending migrations
|
|
23
|
-
config.active_record.migration_error = :page_load
|
|
24
|
-
|
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
|
26
|
-
# This option may cause significant delays in view rendering with a large
|
|
27
|
-
# number of complex assets.
|
|
28
|
-
config.assets.debug = true
|
|
29
9
|
end
|
|
@@ -1,80 +1,12 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# Code is not reloaded between requests.
|
|
5
|
-
config.cache_classes = true
|
|
6
|
-
|
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
-
# your application in memory, allowing both thread web servers
|
|
9
|
-
# and those relying on copy on write to perform better.
|
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
|
2
|
+
config.enable_reloading = false
|
|
11
3
|
config.eager_load = true
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
config.consider_all_requests_local = false
|
|
5
|
+
config.consider_all_requests_local = false
|
|
15
6
|
config.action_controller.perform_caching = true
|
|
16
7
|
|
|
17
|
-
|
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
20
|
-
# config.action_dispatch.rack_cache = true
|
|
21
|
-
|
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
23
|
-
config.serve_static_assets = false
|
|
24
|
-
|
|
25
|
-
# Compress JavaScripts and CSS.
|
|
26
|
-
config.assets.js_compressor = :uglifier
|
|
27
|
-
# config.assets.css_compressor = :sass
|
|
28
|
-
|
|
29
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
30
|
-
config.assets.compile = false
|
|
31
|
-
|
|
32
|
-
# Generate digests for assets URLs.
|
|
33
|
-
config.assets.digest = true
|
|
34
|
-
|
|
35
|
-
# Version of your assets, change this if you want to expire all your assets.
|
|
36
|
-
config.assets.version = '1.0'
|
|
37
|
-
|
|
38
|
-
# Specifies the header that your server uses for sending files.
|
|
39
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
40
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
41
|
-
|
|
42
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
43
|
-
# config.force_ssl = true
|
|
44
|
-
|
|
45
|
-
# Set to :debug to see everything in the log.
|
|
8
|
+
config.public_file_server.enabled = false
|
|
46
9
|
config.log_level = :info
|
|
47
|
-
|
|
48
|
-
# Prepend all log lines with the following tags.
|
|
49
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
|
50
|
-
|
|
51
|
-
# Use a different logger for distributed setups.
|
|
52
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
53
|
-
|
|
54
|
-
# Use a different cache store in production.
|
|
55
|
-
# config.cache_store = :mem_cache_store
|
|
56
|
-
|
|
57
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
58
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
|
59
|
-
|
|
60
|
-
# Precompile additional assets.
|
|
61
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
62
|
-
# config.assets.precompile += %w( search.js )
|
|
63
|
-
|
|
64
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
|
65
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
66
|
-
# config.action_mailer.raise_delivery_errors = false
|
|
67
|
-
|
|
68
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
69
|
-
# the I18n.default_locale when a translation can not be found).
|
|
70
10
|
config.i18n.fallbacks = true
|
|
71
|
-
|
|
72
|
-
# Send deprecation notices to registered listeners.
|
|
73
11
|
config.active_support.deprecation = :notify
|
|
74
|
-
|
|
75
|
-
# Disable automatic flushing of the log to improve performance.
|
|
76
|
-
# config.autoflush_log = false
|
|
77
|
-
|
|
78
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
79
|
-
config.log_formatter = ::Logger::Formatter.new
|
|
80
12
|
end
|
|
@@ -1,41 +1,17 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# The test environment is used exclusively to run your application's
|
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
-
config.cache_classes = true
|
|
9
|
-
|
|
10
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
|
11
|
-
# just for the purpose of running a single test. If you are using a tool that
|
|
12
|
-
# preloads Rails for running tests, you may have to set it to true.
|
|
2
|
+
config.enable_reloading = false
|
|
13
3
|
config.eager_load = false
|
|
14
4
|
|
|
15
|
-
|
|
16
|
-
if Dummy::RAILS_GEM_VERSION < Gem::Version.new('5.0.0')
|
|
17
|
-
config.serve_static_assets = true
|
|
18
|
-
config.static_cache_control = "public, max-age=3600"
|
|
19
|
-
else
|
|
20
|
-
config.public_file_server.enabled = true
|
|
21
|
-
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
22
|
-
end
|
|
5
|
+
config.public_file_server.enabled = true
|
|
23
6
|
|
|
24
|
-
|
|
25
|
-
config.consider_all_requests_local = true
|
|
7
|
+
config.consider_all_requests_local = true
|
|
26
8
|
config.action_controller.perform_caching = false
|
|
27
9
|
|
|
28
10
|
# Raise exceptions instead of rendering exception templates.
|
|
29
|
-
config.action_dispatch.show_exceptions =
|
|
11
|
+
config.action_dispatch.show_exceptions = :none
|
|
30
12
|
|
|
31
13
|
# Disable request forgery protection in test environment.
|
|
32
14
|
config.action_controller.allow_forgery_protection = false
|
|
33
15
|
|
|
34
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
|
35
|
-
# The :test delivery method accumulates sent emails in the
|
|
36
|
-
# ActionMailer::Base.deliveries array.
|
|
37
|
-
config.action_mailer.delivery_method = :test
|
|
38
|
-
|
|
39
|
-
# Print deprecation notices to the stderr.
|
|
40
16
|
config.active_support.deprecation = :stderr
|
|
41
17
|
end
|
data/spec/rails_helper.rb
CHANGED
|
@@ -1,74 +1,28 @@
|
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
1
|
ENV['RAILS_ENV'] ||= 'test'
|
|
3
2
|
require File.expand_path("../dummy/config/environment", __FILE__)
|
|
4
|
-
# Prevent
|
|
3
|
+
# Prevent accidental runs against production.
|
|
5
4
|
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
|
6
5
|
require 'spec_helper'
|
|
7
6
|
require 'rspec/rails'
|
|
8
|
-
# Add additional requires below this line. Rails is not loaded until this point!
|
|
9
|
-
|
|
10
|
-
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
11
|
-
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
12
|
-
# run as spec files by default. This means that files in spec/support that end
|
|
13
|
-
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
14
|
-
# run twice. It is recommended that you do not name files matching this glob to
|
|
15
|
-
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
16
|
-
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
17
|
-
#
|
|
18
|
-
# The following line is provided for convenience purposes. It has the downside
|
|
19
|
-
# of increasing the boot-up time by auto-requiring all files in the support
|
|
20
|
-
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
21
|
-
# require only the support files necessary.
|
|
22
|
-
#
|
|
23
|
-
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
24
|
-
|
|
25
|
-
if Dummy::RAILS_GEM_VERSION > Gem::Version.new('4.1.0')
|
|
26
|
-
# Checks for pending migration and applies them before tests are run.
|
|
27
|
-
# If you are not using ActiveRecord, you can remove this line.
|
|
28
|
-
ActiveRecord::Migration.maintain_test_schema!
|
|
29
|
-
end
|
|
30
7
|
|
|
31
8
|
RSpec.configure do |config|
|
|
32
|
-
#
|
|
33
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
34
|
-
|
|
35
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
36
|
-
# examples within a transaction, remove the following line or assign false
|
|
37
|
-
# instead of true.
|
|
38
|
-
config.use_transactional_fixtures = true
|
|
39
|
-
|
|
40
|
-
# RSpec Rails can automatically mix in different behaviours to your tests
|
|
41
|
-
# based on their file location, for example enabling you to call `get` and
|
|
42
|
-
# `post` in specs under `spec/controllers`.
|
|
43
|
-
#
|
|
44
|
-
# You can disable this behaviour by removing the line below, and instead
|
|
45
|
-
# explicitly tag your specs with their type, e.g.:
|
|
46
|
-
#
|
|
47
|
-
# RSpec.describe UsersController, :type => :controller do
|
|
48
|
-
# # ...
|
|
49
|
-
# end
|
|
50
|
-
#
|
|
51
|
-
# The different available types are documented in the features, such as in
|
|
52
|
-
# https://relishapp.com/rspec/rspec-rails/docs
|
|
9
|
+
# Enables `get`/`post` etc. in specs under spec/controllers.
|
|
53
10
|
config.infer_spec_type_from_file_location!
|
|
54
11
|
|
|
55
12
|
# Filter lines from Rails gems in backtraces.
|
|
56
13
|
config.filter_rails_from_backtrace!
|
|
57
|
-
# arbitrary gems may also be filtered via:
|
|
58
|
-
# config.filter_gems_from_backtrace("gem name")
|
|
59
14
|
end
|
|
60
15
|
|
|
61
|
-
|
|
62
16
|
# some helper methods
|
|
63
17
|
|
|
64
18
|
def simulate_redirect!(from_action, to_action)
|
|
65
19
|
get from_action.intern
|
|
66
|
-
from_flash = request.flash
|
|
20
|
+
from_flash = request.flash
|
|
67
21
|
|
|
68
22
|
controller.instance_variable_set(:@_frikandel_did_reset_session, nil) # reset state for redirect request
|
|
69
23
|
|
|
70
24
|
get to_action.intern
|
|
71
|
-
request.flash.update(from_flash.to_hash)
|
|
25
|
+
request.flash.update(from_flash.to_hash)
|
|
72
26
|
end
|
|
73
27
|
|
|
74
28
|
def flash
|
|
@@ -14,11 +14,6 @@ class ApplicationController < ActionController::Base
|
|
|
14
14
|
protect_from_forgery with: :exception
|
|
15
15
|
|
|
16
16
|
def home
|
|
17
|
-
|
|
18
|
-
if Rails::VERSION::MAJOR >= 5
|
|
19
|
-
render plain: "testing"
|
|
20
|
-
else
|
|
21
|
-
render text: "testing"
|
|
22
|
-
end
|
|
17
|
+
render plain: "testing"
|
|
23
18
|
end
|
|
24
19
|
end
|