action_controller_tweaks 0.3.3 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 32c48964a8eb1edff1a62fea53d2fbfbf559c58e
4
- data.tar.gz: 6d9bf06a6f1e5099640c08ee7bbcef7b7f25dc4f
2
+ SHA256:
3
+ metadata.gz: 8e1ad532f632a4001e830643cfaefbde5e73257a5c9a62110390f8b1940023f4
4
+ data.tar.gz: d9d9ff38e38a4e789e88af61e873179506b5614467a8918bd631c1b4d07d745b
5
5
  SHA512:
6
- metadata.gz: f30b8b0227085d9e12a73c828e0094c739be7b9070bbaeab132987e529131304a1513e0071ac07593bc64e47533b52d458888f31104ce941298435ba2cbf9ad0
7
- data.tar.gz: 7a84018fb3dae5d322313be61dbba060431207f06adb98ccbbc95aabb174acf146b383d930cd35ea9dd131edf068a8de42ee38eacf93695051a07299c6c16a6d
6
+ metadata.gz: 8663ab21dfad733fa8b129a7b3042672e73bed4d76737f8672575b602753f0150a7acd194b9e9e827cfc5c3dee8ba7c17d92650193ad3265bea26967bcb371cd
7
+ data.tar.gz: ecc9e066e4ffb983de50d7bcfa37a55d2df3f871cc26d72f9405c3712d3fd5b15ca23f9b53fa31a1dab185bcd3740578dc81e9878cdbe34885973129c89ed2cf
@@ -0,0 +1,13 @@
1
+ # Lines starting with '#' are comments.
2
+ # Each line is a file pattern followed by one or more owners.
3
+
4
+ # These owners will be the default owners for everything in the repo.
5
+ * @PikachuEXE
6
+
7
+ # Order is important. The last matching pattern has the most precedence.
8
+ # So if a pull request only touches javascript files, only these owners
9
+ # will be requested to review.
10
+ # *.rb @PikachuEXE
11
+
12
+ # You can also use email addresses if you prefer.
13
+ # docs/* docs@example.com
@@ -0,0 +1,2 @@
1
+ github:
2
+ - PikachuEXE
@@ -0,0 +1,20 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: monthly
7
+ time: "06:00"
8
+ timezone: Asia/Hong_Kong
9
+ open-pull-requests-limit: 10
10
+ labels:
11
+ - "dependencies"
12
+ - package-ecosystem: github-actions
13
+ directory: "/"
14
+ schedule:
15
+ interval: monthly
16
+ time: "06:00"
17
+ timezone: Asia/Hong_Kong
18
+ open-pull-requests-limit: 10
19
+ labels:
20
+ - "dependencies"
@@ -0,0 +1,66 @@
1
+ name: Coverage
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ paths-ignore:
8
+ - 'README.md'
9
+ push:
10
+ branches:
11
+ - master
12
+ paths-ignore:
13
+ - 'README.md'
14
+
15
+ jobs:
16
+ coverage:
17
+ name: Coverage
18
+ # Homemade support for [ci skip] no longer needed
19
+ # https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
20
+ # if: "contains(github.event.commits[0].message, '[ci skip]') == false"
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os:
25
+ - ubuntu
26
+ ruby:
27
+ - "2.7"
28
+ gemfile:
29
+ - gemfiles/rails_5_2.gemfile
30
+ - gemfiles/rails_6_0.gemfile
31
+ - gemfiles/rails_6_1.gemfile
32
+ - gemfiles/rails_7_0.gemfile
33
+ env:
34
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
35
+ COVERALLS: true
36
+ runs-on: ${{ matrix.os }}-latest
37
+ steps:
38
+ - name: Checkout
39
+ uses: actions/checkout@v3
40
+
41
+ - name: Setup Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ bundler-cache: true
46
+
47
+ - name: Collect coverage info
48
+ run: bundle exec rake spec
49
+
50
+ - name: Coveralls Parallel
51
+ uses: coverallsapp/github-action@master
52
+ continue-on-error: true
53
+ with:
54
+ github-token: ${{ secrets.github_token }}
55
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.gemfile }}
56
+ parallel: true
57
+
58
+ finish:
59
+ needs: coverage
60
+ runs-on: ubuntu-latest
61
+ steps:
62
+ - name: Send to Coveralls
63
+ uses: coverallsapp/github-action@master
64
+ with:
65
+ github-token: ${{ secrets.GITHUB_TOKEN }}
66
+ parallel-finished: true
@@ -0,0 +1,56 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ paths-ignore:
8
+ - 'README.md'
9
+ push:
10
+ branches:
11
+ - master
12
+ paths-ignore:
13
+ - 'README.md'
14
+
15
+ jobs:
16
+ unit_tests:
17
+ name: Unit Tests
18
+ # Homemade support for [ci skip] no longer needed
19
+ # https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
20
+ # if: "contains(github.event.commits[0].message, '[ci skip]') == false"
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os:
25
+ - ubuntu
26
+ ruby:
27
+ - "2.7"
28
+ - "3.0"
29
+ - "3.1"
30
+ gemfile:
31
+ - gemfiles/rails_5_2.gemfile
32
+ - gemfiles/rails_6_0.gemfile
33
+ - gemfiles/rails_6_1.gemfile
34
+ - gemfiles/rails_7_0.gemfile
35
+ allow_failures:
36
+ - false
37
+ include:
38
+ - os: ubuntu
39
+ ruby: ruby-head
40
+ gemfile: gemfiles/rails_7_0.gemfile
41
+ allow_failures: true
42
+ env:
43
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
44
+ ALLOW_FAILURES: "${{ matrix.allow_failures }}"
45
+ runs-on: ${{ matrix.os }}-latest
46
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
47
+ steps:
48
+ - name: Checkout
49
+ uses: actions/checkout@v3
50
+ - name: Setup Ruby
51
+ uses: ruby/setup-ruby@v1
52
+ with:
53
+ ruby-version: ${{ matrix.ruby }}
54
+ bundler-cache: true
55
+ - name: Test
56
+ run: bundle exec rake spec || $ALLOW_FAILURES
data/Appraisals CHANGED
@@ -1,30 +1,30 @@
1
1
 
2
- appraise "rails_4_1" do
3
- version = "~> 4.1.8"
2
+ appraise "rails_5_2" do
3
+ version = "~> 5.2.0"
4
4
  gem "activesupport", version
5
5
  gem "actionpack", version
6
6
  gem "activerecord", version
7
7
  gem "railties", version
8
8
  end
9
9
 
10
- appraise "rails_4_2" do
11
- version = "~> 4.2.0"
10
+ appraise "rails_6_0" do
11
+ version = "~> 6.0.0"
12
12
  gem "activesupport", version
13
13
  gem "actionpack", version
14
14
  gem "activerecord", version
15
15
  gem "railties", version
16
16
  end
17
17
 
18
- appraise "rails_5_0" do
19
- version = "~> 5.0.0"
18
+ appraise "rails_6_1" do
19
+ version = "~> 6.1.0"
20
20
  gem "activesupport", version
21
21
  gem "actionpack", version
22
22
  gem "activerecord", version
23
23
  gem "railties", version
24
24
  end
25
25
 
26
- appraise "rails_5_1" do
27
- version = "~> 5.1.0"
26
+ appraise "rails_7_0" do
27
+ version = "~> 7.0.0"
28
28
  gem "activesupport", version
29
29
  gem "actionpack", version
30
30
  gem "activerecord", version
data/CHANGELOG.md CHANGED
@@ -18,6 +18,29 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [0.3.6] - 2022-04-12
22
+
23
+ ### Changed
24
+
25
+ - Add support for AR 7.x
26
+ - Drop support for Ruby < 2.7
27
+
28
+
29
+ ## [0.3.5] - 2020-09-07
30
+
31
+ ### Fixed
32
+
33
+ - Fix support for Rails 6.x
34
+
35
+
36
+ ## [0.3.4] - 2019-08-26
37
+
38
+ ### Changed
39
+
40
+ - Add support for AR 6.x
41
+ - Drop support for Ruby < 2.4
42
+
43
+
21
44
  ## [0.3.3] - 2017-05-11
22
45
 
23
46
  ### Changed
@@ -79,9 +102,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
79
102
  - Initial Release
80
103
 
81
104
 
82
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v0.3.2...HEAD
83
- [0.3.1]: https://github.com/AssetSync/asset_sync/compare/v0.3.1...v0.3.2
84
- [0.3.1]: https://github.com/AssetSync/asset_sync/compare/v0.3.0...v0.3.1
85
- [0.3.0]: https://github.com/AssetSync/asset_sync/compare/v0.2.0...v0.3.0
86
- [0.2.0]: https://github.com/AssetSync/asset_sync/compare/v0.1...v0.2.0
105
+ [Unreleased]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.5...HEAD
106
+ [0.3.4]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.4...v0.3.5
107
+ [0.3.4]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.3...v0.3.4
108
+ [0.3.3]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.2...v0.3.3
109
+ [0.3.2]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.1...v0.3.2
110
+ [0.3.1]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.3.0...v0.3.1
111
+ [0.3.0]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.2.0...v0.3.0
112
+ [0.2.0]: https://github.com/PikachuEXE/action_controller_tweaks/compare/v0.1...v0.2.0
87
113
 
data/README.md CHANGED
@@ -5,11 +5,15 @@ ActionController is great, but could be better. Here are some tweaks for it.
5
5
 
6
6
  ## Status
7
7
 
8
- [![Build Status](http://img.shields.io/travis/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](https://travis-ci.org/PikachuEXE/action_controller_tweaks)
8
+ [![GitHub Build Status](https://img.shields.io/github/workflow/status/PikachuEXE/action_controller_tweaks/Tests?style=flat-square)](https://github.com/PikachuEXE/action_controller_tweaks/actions?query=workflow%3ATests)
9
+
9
10
  [![Gem Version](http://img.shields.io/gem/v/action_controller_tweaks.svg?style=flat-square)](http://badge.fury.io/rb/action_controller_tweaks)
10
- [![Dependency Status](http://img.shields.io/gemnasium/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](https://gemnasium.com/PikachuEXE/action_controller_tweaks)
11
+ [![License](https://img.shields.io/github/license/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](http://badge.fury.io/rb/action_controller_tweaks)
12
+
11
13
  [![Coverage Status](http://img.shields.io/coveralls/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](https://coveralls.io/r/PikachuEXE/action_controller_tweaks)
12
- [![Code Climate](http://img.shields.io/codeclimate/github/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](https://codeclimate.com/github/PikachuEXE/action_controller_tweaks)
14
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/PikachuEXE/action_controller_tweaks.svg?style=flat-square)](https://codeclimate.com/github/PikachuEXE/action_controller_tweaks)
15
+
16
+ > The above badges are generated by https://shields.io/
13
17
 
14
18
 
15
19
  ## Installation
@@ -40,7 +44,7 @@ Usage:
40
44
  ### `#set_session` & `#set_session_with_expiry`
41
45
  I write this on my own, it's ok to blame me if it's buggy :P
42
46
  This method let's you set session, with expiry time!
43
- It depends on `before_filter`/`before_action` to remove expired session keys
47
+ It depends on `before_action` to remove expired session keys
44
48
  Valid options: `expire_in`, `expires_in`, `expire_at`, `expires_at`
45
49
  Example:
46
50
  ```ruby
data/Rakefile CHANGED
@@ -1,14 +1,11 @@
1
1
  require "appraisal"
2
2
  require "bundler"
3
3
  require "rspec/core/rake_task"
4
- require "rubocop/rake_task"
5
4
 
6
5
  Bundler::GemHelper.install_tasks
7
6
 
8
7
  RSpec::Core::RakeTask.new(:spec)
9
8
 
10
- RuboCop::RakeTask.new(:rubocop)
11
-
12
9
  if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
13
10
  task :default do
14
11
  sh "appraisal install && rake appraisal spec"
@@ -24,26 +24,26 @@ Gem::Specification.new do |s|
24
24
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
25
25
  s.require_paths = ["lib"]
26
26
 
27
- s.add_dependency "activesupport", ">= 4.1.0", "< 6.0.0"
28
- s.add_dependency "actionpack", ">= 4.1.0", "< 6.0.0"
27
+ s.add_dependency "activesupport", ">= 5.2.0", "< 8.0.0"
28
+ s.add_dependency "actionpack", ">= 5.2.0", "< 8.0.0"
29
29
 
30
30
  s.add_development_dependency "bundler", ">= 1.0.0"
31
- s.add_development_dependency "rake", ">= 10.0", "<= 13.0"
31
+ s.add_development_dependency "rake", ">= 10.0", "<= 14.0"
32
32
  s.add_development_dependency "appraisal", "~> 2.0"
33
- s.add_development_dependency "rspec-rails", "~> 3.0"
33
+ s.add_development_dependency "rspec-rails", "~> 5.1"
34
34
  s.add_development_dependency "rspec-its", "~> 1.0"
35
35
  # rspec-rails needs activerecord...
36
36
  s.add_development_dependency "activerecord", ">= 4.0.0"
37
37
  s.add_development_dependency "sqlite3", ">= 1.3"
38
38
  s.add_development_dependency "database_cleaner", ">= 1.0"
39
39
  s.add_development_dependency "timecop", ">= 0.6"
40
- s.add_development_dependency "coveralls", ">= 0.7"
40
+ s.add_development_dependency "simplecov", ">= 0.21"
41
+ s.add_development_dependency "simplecov-lcov", ">= 0.8"
41
42
  s.add_development_dependency "gem-release", ">= 0.7"
42
43
  # This is for rails < 4.1 on MRI 2.2 (and other later version I suppose)
43
44
  s.add_development_dependency "test-unit", ">= 3.0.0"
44
- s.add_development_dependency "rubocop", "~> 0.30"
45
45
 
46
- s.required_ruby_version = ">= 2.2.0"
46
+ s.required_ruby_version = ">= 2.7.0"
47
47
 
48
48
  s.required_rubygems_version = ">= 1.4.0"
49
49
  end
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 5.2.0"
6
+ gem "actionpack", "~> 5.2.0"
7
+ gem "activerecord", "~> 5.2.0"
8
+ gem "railties", "~> 5.2.0"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.0.0"
6
+ gem "actionpack", "~> 6.0.0"
7
+ gem "activerecord", "~> 6.0.0"
8
+ gem "railties", "~> 6.0.0"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.1.0"
6
+ gem "actionpack", "~> 6.1.0"
7
+ gem "activerecord", "~> 6.1.0"
8
+ gem "railties", "~> 6.1.0"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 7.0.0"
6
+ gem "actionpack", "~> 7.0.0"
7
+ gem "activerecord", "~> 7.0.0"
8
+ gem "railties", "~> 7.0.0"
9
+
10
+ gemspec path: "../"
@@ -6,12 +6,11 @@ module ActionControllerTweaks
6
6
 
7
7
  HEADERS = {
8
8
  # HTTP 1.1
9
- "Cache-Control" => "no-cache, no-store, max-age=0, "\
10
- "must-revalidate, pre-check=0, post-check=0",
9
+ "Cache-Control" => "no-cache, no-store, pre-check=0, post-check=0",
11
10
  # HTTP 1.0
12
11
  "Pragma" => "no-cache",
13
12
  # HTTP 1.0
14
- "Expires" => "Fri, 01 Jan 1990 00:00:00 GMT",
13
+ "Expires" => "Mon, 01 Jan 1990 00:00:00 GMT",
15
14
  }.freeze
16
15
 
17
16
  included do
@@ -1,3 +1,8 @@
1
+ # `require "active_support"` required for rails 7
2
+ # See more in
3
+ # - https://github.com/rails/rails/issues/43851
4
+ # - https://github.com/alphagov/govspeak/commit/fa9805297a07e1bdd90a1b47814980fe52ae55ec
5
+ require "active_support"
1
6
  require "active_support/concern"
2
7
  require "active_support/time"
3
8
 
@@ -47,14 +52,13 @@ module ActionControllerTweaks
47
52
  end
48
53
 
49
54
  included do
55
+ # Rails 4+
50
56
  if respond_to?(:before_action)
51
57
  before_action :_delete_expired_session_keys
52
- elsif respond_to?(:before_filter)
53
- before_filter :_delete_expired_session_keys
54
58
  else
55
59
  fail(
56
60
  NotImplementedError,
57
- "There is no `.before_action` nor `.before_filter` in this class",
61
+ "There is no `.before_action` in this class",
58
62
  )
59
63
  end
60
64
 
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActionControllerTweaks
2
- VERSION = "0.3.3"
4
+ VERSION = "0.3.6"
3
5
 
4
6
  def self.version
5
7
  Gem::Version.new(VERSION)
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe NotController do
4
4
  describe "::Session" do
5
- context "when included by a class without `before_action` or `before_filter`" do
5
+ context "when included by a class without `before_action`" do
6
6
  it "raises error" do
7
7
  expect do
8
8
  described_class.class_eval do
@@ -32,8 +32,23 @@ describe PostsController, type: :controller do
32
32
  end
33
33
 
34
34
  it "includes the pre defined headeres" do
35
- expect(controller.headers.
36
- deep_include?(ActionControllerTweaks::Caching::HEADERS)).to be true
35
+ header_hash = controller.headers.to_h
36
+ is_rails_6_1_plus = Gem::Requirement.create([">= 6.1"]).
37
+ satisfied_by?(::Rails.gem_version)
38
+
39
+ aggregate_failures do
40
+ ActionControllerTweaks::Caching::HEADERS.each_pair do |header_name, header_value|
41
+ # Workaround for rails 6.1 updating value
42
+ # when input value contains `no-store`
43
+ #
44
+ # https://github.com/rails/rails/issues/40798
45
+ if header_name == "Cache-Control" && is_rails_6_1_plus
46
+ expect(header_hash[header_name]).to include("no-store")
47
+ else
48
+ expect(header_hash[header_name]).to eq(header_value)
49
+ end
50
+ end
51
+ end
37
52
  end
38
53
  end
39
54
  end
@@ -96,7 +111,7 @@ describe PostsController, type: :controller do
96
111
  context "before expire time" do
97
112
  before do
98
113
  Timecop.travel(time_before_expire)
99
- # Runs before_filter
114
+ # Runs before_action
100
115
  get :index
101
116
  end
102
117
 
@@ -107,7 +122,7 @@ describe PostsController, type: :controller do
107
122
  context "after expire time" do
108
123
  before do
109
124
  Timecop.travel(time_after_expire)
110
- # Runs before_filter
125
+ # Runs before_action
111
126
  get :index
112
127
  end
113
128
 
@@ -152,7 +167,7 @@ describe PostsController, type: :controller do
152
167
  context "before expire time" do
153
168
  before do
154
169
  Timecop.travel(time_before_expire)
155
- # Runs before_filter
170
+ # Runs before_action
156
171
  get :index
157
172
  end
158
173
 
@@ -163,7 +178,7 @@ describe PostsController, type: :controller do
163
178
  context "after expire time" do
164
179
  before do
165
180
  Timecop.travel(time_after_expire)
166
- # Runs before_filter
181
+ # Runs before_action
167
182
  get :index
168
183
  end
169
184
 
@@ -195,7 +210,7 @@ describe PostsController, type: :controller do
195
210
  context "before expire time" do
196
211
  before do
197
212
  Timecop.travel(time_before_expire)
198
- # Runs before_filter
213
+ # Runs before_action
199
214
  get :index
200
215
  end
201
216
 
@@ -206,7 +221,7 @@ describe PostsController, type: :controller do
206
221
  context "after expire time" do
207
222
  before do
208
223
  Timecop.travel(time_after_expire)
209
- # Runs before_filter
224
+ # Runs before_action
210
225
  get :index
211
226
  end
212
227
 
@@ -237,7 +252,7 @@ describe PostsController, type: :controller do
237
252
  context "before expire time" do
238
253
  before do
239
254
  Timecop.travel(time_before_expire)
240
- # Runs before_filter
255
+ # Runs before_action
241
256
  get :index
242
257
  end
243
258
 
@@ -248,7 +263,7 @@ describe PostsController, type: :controller do
248
263
  context "after expire time" do
249
264
  before do
250
265
  Timecop.travel(time_after_expire)
251
- # Runs before_filter
266
+ # Runs before_action
252
267
  get :index
253
268
  end
254
269
 
@@ -369,7 +384,7 @@ describe PostsController, type: :controller do
369
384
  before do
370
385
  session["session_keys_to_expire"] = {session_key => ""}
371
386
 
372
- # Runs before_filter
387
+ # Runs before_action
373
388
  get :index
374
389
  end
375
390
 
@@ -463,7 +478,7 @@ describe PostsController, type: :controller do
463
478
  context "before expire time" do
464
479
  before do
465
480
  Timecop.travel(time_before_expire)
466
- # Runs before_filter
481
+ # Runs before_action
467
482
  get :index
468
483
  end
469
484
 
@@ -474,7 +489,7 @@ describe PostsController, type: :controller do
474
489
  context "after expire time" do
475
490
  before do
476
491
  Timecop.travel(time_after_expire)
477
- # Runs before_filter
492
+ # Runs before_action
478
493
  get :index
479
494
  end
480
495
 
@@ -516,7 +531,7 @@ describe PostsController, type: :controller do
516
531
  context "before expire time" do
517
532
  before do
518
533
  Timecop.travel(time_before_expire)
519
- # Runs before_filter
534
+ # Runs before_action
520
535
  get :index
521
536
  end
522
537
 
@@ -527,7 +542,7 @@ describe PostsController, type: :controller do
527
542
  context "after expire time" do
528
543
  before do
529
544
  Timecop.travel(time_after_expire)
530
- # Runs before_filter
545
+ # Runs before_action
531
546
  get :index
532
547
  end
533
548
 
@@ -559,7 +574,7 @@ describe PostsController, type: :controller do
559
574
  context "before expire time" do
560
575
  before do
561
576
  Timecop.travel(time_before_expire)
562
- # Runs before_filter
577
+ # Runs before_action
563
578
  get :index
564
579
  end
565
580
 
@@ -570,7 +585,7 @@ describe PostsController, type: :controller do
570
585
  context "after expire time" do
571
586
  before do
572
587
  Timecop.travel(time_after_expire)
573
- # Runs before_filter
588
+ # Runs before_action
574
589
  get :index
575
590
  end
576
591
 
@@ -601,7 +616,7 @@ describe PostsController, type: :controller do
601
616
  context "before expire time" do
602
617
  before do
603
618
  Timecop.travel(time_before_expire)
604
- # Runs before_filter
619
+ # Runs before_action
605
620
  get :index
606
621
  end
607
622
 
@@ -612,7 +627,7 @@ describe PostsController, type: :controller do
612
627
  context "after expire time" do
613
628
  before do
614
629
  Timecop.travel(time_after_expire)
615
- # Runs before_filter
630
+ # Runs before_action
616
631
  get :index
617
632
  end
618
633
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,21 @@
1
- if ENV["TRAVIS"]
2
- require "coveralls"
3
- Coveralls.wear!("rails")
1
+ # frozen_string_literal: true
2
+
3
+ if ENV["COVERALLS"]
4
+ require "simplecov"
5
+ require "simplecov-lcov"
6
+
7
+ SimpleCov::Formatter::LcovFormatter.config do |c|
8
+ c.report_with_single_file = true
9
+ c.single_report_path = "coverage/lcov.info"
10
+ end
11
+
12
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
13
+ [SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::LcovFormatter]
14
+ )
15
+
16
+ SimpleCov.start do
17
+ add_filter "spec/"
18
+ end
4
19
  end
5
20
 
6
21
  require "action_controller_tweaks"
@@ -35,3 +50,21 @@ end
35
50
 
36
51
  RSpec.configure do
37
52
  end
53
+
54
+
55
+ # Monkey patch for rails 4.2 + ruby 2.6
56
+ # https://github.com/rails/rails/issues/34790
57
+ if RUBY_VERSION>='2.6.0'
58
+ if Rails.version < '5'
59
+ class ActionController::TestResponse < ActionDispatch::TestResponse
60
+ def recycle!
61
+ # hack to avoid MonitorMixin double-initialize error:
62
+ @mon_mutex_owner_object_id = nil
63
+ @mon_mutex = nil
64
+ initialize
65
+ end
66
+ end
67
+ else
68
+ puts "Monkeypatch for ActionController::TestResponse no longer needed"
69
+ end
70
+ end