frikandel 2.1.0 → 2.3.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.
@@ -1,43 +1,43 @@
1
- require "spec_helper"
1
+ require "rails_helper"
2
2
 
3
- describe Frikandel::Configuration do
3
+ RSpec.describe Frikandel::Configuration do
4
4
 
5
5
  it "is a singleton" do
6
- Frikandel::Configuration.should respond_to :instance
7
- Frikandel::Configuration.instance.should be_a Frikandel::Configuration
8
- Frikandel::Configuration.instance.should be_equal Frikandel::Configuration.instance
6
+ expect(Frikandel::Configuration).to respond_to :instance
7
+ expect(Frikandel::Configuration.instance).to be_a Frikandel::Configuration
8
+ expect(Frikandel::Configuration.instance).to be_equal Frikandel::Configuration.instance
9
9
  end
10
10
 
11
11
  it "delegates max_ttl and max_ttl= to the singleton instance" do
12
- Frikandel::Configuration.instance.should_receive(:max_ttl).and_return(:some_max_ttl)
13
- Frikandel::Configuration.instance.should_receive(:max_ttl=).with(:some_value).and_return(:some_max_ttl=)
12
+ expect(Frikandel::Configuration.instance).to receive(:max_ttl).and_return(:some_max_ttl)
13
+ expect(Frikandel::Configuration.instance).to receive(:max_ttl=).with(:some_value).and_return(:some_max_ttl=)
14
14
 
15
- Frikandel::Configuration.max_ttl.should eq :some_max_ttl
16
- Frikandel::Configuration.send(:max_ttl=, :some_value).should eq :some_max_ttl=
15
+ expect(Frikandel::Configuration.max_ttl).to eq :some_max_ttl
16
+ expect(Frikandel::Configuration.send(:max_ttl=, :some_value)).to eq :some_max_ttl=
17
17
  end
18
18
 
19
19
  it "delegates ttl and ttl= to the singleton instance" do
20
- Frikandel::Configuration.instance.should_receive(:ttl).and_return(:some_ttl)
21
- Frikandel::Configuration.instance.should_receive(:ttl=).with(:some_value).and_return(:some_ttl=)
20
+ expect(Frikandel::Configuration.instance).to receive(:ttl).and_return(:some_ttl)
21
+ expect(Frikandel::Configuration.instance).to receive(:ttl=).with(:some_value).and_return(:some_ttl=)
22
22
 
23
- Frikandel::Configuration.ttl.should eq :some_ttl
24
- Frikandel::Configuration.send(:ttl=, :some_value).should eq :some_ttl=
23
+ expect(Frikandel::Configuration.ttl).to eq :some_ttl
24
+ expect(Frikandel::Configuration.send(:ttl=, :some_value)).to eq :some_ttl=
25
25
  end
26
26
 
27
27
  it "has 24 hours as default-max_ttl" do
28
- Frikandel::Configuration.max_ttl.should eq 24.hours
28
+ expect(Frikandel::Configuration.max_ttl).to eq 24.hours
29
29
  end
30
30
 
31
31
  it "has 2 hours as default-ttl" do
32
- Frikandel::Configuration.ttl.should eq 2.hours
32
+ expect(Frikandel::Configuration.ttl).to eq 2.hours
33
33
  end
34
34
 
35
35
  it "ttls can be set" do
36
36
  Frikandel::Configuration.max_ttl = 50.hours
37
37
  Frikandel::Configuration.ttl = 5.hours
38
38
 
39
- Frikandel::Configuration.max_ttl.should eq 50.hours
40
- Frikandel::Configuration.ttl.should eq 5.hours
39
+ expect(Frikandel::Configuration.max_ttl).to eq 50.hours
40
+ expect(Frikandel::Configuration.ttl).to eq 5.hours
41
41
  end
42
42
 
43
43
  end
@@ -0,0 +1,76 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment", __FILE__)
4
+ # Prevent database truncation if the environment is production
5
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
6
+ require 'spec_helper'
7
+ 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
+
31
+ RSpec.configure do |config|
32
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
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
53
+ config.infer_spec_type_from_file_location!
54
+
55
+ # Filter lines from Rails gems in backtraces.
56
+ config.filter_rails_from_backtrace!
57
+ # arbitrary gems may also be filtered via:
58
+ # config.filter_gems_from_backtrace("gem name")
59
+ end
60
+
61
+
62
+ # some helper methods
63
+
64
+ def simulate_redirect!(from_action, to_action)
65
+ get from_action.intern
66
+ from_flash = request.flash # HACK for RAILS_VERSION=3.2.0
67
+
68
+ controller.instance_variable_set(:@_frikandel_did_reset_session, nil) # reset state for redirect request
69
+
70
+ get to_action.intern
71
+ request.flash.update(from_flash.to_hash) # HACK for RAILS_VERSION=3.2.0
72
+ end
73
+
74
+ def flash
75
+ request.flash
76
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,38 +1,102 @@
1
- ENV["RAILS_ENV"] ||= 'test'
2
- require File.expand_path("../dummy/config/environment", __FILE__)
3
- require 'rspec/rails'
4
1
  require 'pry'
5
2
 
3
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # The `.rspec` file also contains a few flags that are not defaults but that
18
+ # users commonly want.
19
+ #
6
20
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
21
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
- config.run_all_when_everything_filtered = true
10
- config.filter_run :focus
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
46
+ # have no way to turn it off -- the option exists only for backwards
47
+ # compatibility in RSpec 3). It causes shared context metadata to be
48
+ # inherited by the metadata hash of host groups and examples, rather than
49
+ # triggering implicit auto-inclusion in groups with matching metadata.
50
+ config.shared_context_metadata_behavior = :apply_to_host_groups
51
+
52
+ # This allows you to limit a spec run to individual examples or groups
53
+ # you care about by tagging them with `:focus` metadata. When nothing
54
+ # is tagged with `:focus`, all examples get run. RSpec also provides
55
+ # aliases for `it`, `describe`, and `context` that include `:focus`
56
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
57
+ config.filter_run_when_matching :focus
58
+
59
+ # Allows RSpec to persist some state between runs in order to support
60
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
61
+ # you configure your source control system to ignore this file.
62
+ #config.example_status_persistence_file_path = "spec/examples.txt"
63
+
64
+ # Limits the available syntax to the non-monkey patched syntax that is
65
+ # recommended. For more details, see:
66
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
67
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
68
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
69
+ config.disable_monkey_patching!
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ #config.profile_examples = 10
11
85
 
12
86
  # Run specs in random order to surface order dependencies. If you find an
13
87
  # order dependency and want to debug it, you can fix the order by providing
14
88
  # the seed, which is printed after each run.
15
89
  # --seed 1234
16
- config.order = 'random'
90
+ config.order = :random
17
91
 
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+
98
+ # Frikandel
18
99
  config.before(:each) do
19
100
  Frikandel::Configuration.defaults!
20
101
  end
21
102
  end
22
-
23
-
24
- # some helper methods
25
-
26
- def simulate_redirect!(from_action, to_action)
27
- get from_action.intern
28
- from_flash = request.flash # HACK for RAILS_VERSION=3.2.0
29
-
30
- controller.instance_variable_set(:@_frikandel_did_reset_session, nil) # reset state for redirect request
31
-
32
- get to_action.intern
33
- request.flash.update(from_flash.to_hash) # HACK for RAILS_VERSION=3.2.0
34
- end
35
-
36
- def flash
37
- request.flash
38
- end
@@ -14,6 +14,11 @@ class ApplicationController < ActionController::Base
14
14
  protect_from_forgery with: :exception
15
15
 
16
16
  def home
17
- render text: "testing"
17
+
18
+ if Rails::VERSION::MAJOR >= 5
19
+ render plain: "testing"
20
+ else
21
+ render text: "testing"
22
+ end
18
23
  end
19
24
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frikandel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taktsoft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '0'
20
20
  type: :development
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: '1.5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,6 +54,20 @@ dependencies:
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: guard-rspec
84
+ name: pry
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: pry
98
+ name: test-unit
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -101,9 +115,6 @@ dependencies:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: 3.2.0
104
- - - "<"
105
- - !ruby/object:Gem::Version
106
- version: '5.0'
107
118
  type: :runtime
108
119
  prerelease: false
109
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,9 +122,6 @@ dependencies:
111
122
  - - ">="
112
123
  - !ruby/object:Gem::Version
113
124
  version: 3.2.0
114
- - - "<"
115
- - !ruby/object:Gem::Version
116
- version: '5.0'
117
125
  description: This gem adds a ttl to the session cookie of your application.
118
126
  email:
119
127
  - developers@taktsoft.com
@@ -125,9 +133,8 @@ files:
125
133
  - ".rspec"
126
134
  - ".travis.yml"
127
135
  - Gemfile
128
- - Gemfile.rails-3.2.x
129
- - Gemfile.rails-4.0.x
130
- - Gemfile.rails-4.1.x
136
+ - Gemfile.rails-5.2.x
137
+ - Gemfile.rails-6.0.x
131
138
  - Gemfile.rails-head
132
139
  - Guardfile
133
140
  - LICENSE.txt
@@ -146,6 +153,7 @@ files:
146
153
  - spec/controllers/limit_session_lifetime_controller_spec.rb
147
154
  - spec/dummy/README.rdoc
148
155
  - spec/dummy/Rakefile
156
+ - spec/dummy/app/assets/config/manifest.js
149
157
  - spec/dummy/app/assets/images/.keep
150
158
  - spec/dummy/app/assets/javascripts/application.js
151
159
  - spec/dummy/app/assets/stylesheets/application.css
@@ -183,6 +191,7 @@ files:
183
191
  - spec/dummy/public/500.html
184
192
  - spec/dummy/public/favicon.ico
185
193
  - spec/lib/frikandel/configuration_spec.rb
194
+ - spec/rails_helper.rb
186
195
  - spec/spec_helper.rb
187
196
  - spec/support/application_controller.rb
188
197
  homepage: https://github.com/taktsoft/frikandel
@@ -197,55 +206,56 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
206
  requirements:
198
207
  - - ">="
199
208
  - !ruby/object:Gem::Version
200
- version: '0'
209
+ version: 1.9.3
201
210
  required_rubygems_version: !ruby/object:Gem::Requirement
202
211
  requirements:
203
212
  - - ">="
204
213
  - !ruby/object:Gem::Version
205
- version: '0'
214
+ version: 1.3.6
206
215
  requirements: []
207
- rubyforge_project:
208
- rubygems_version: 2.2.2
216
+ rubygems_version: 3.0.3
209
217
  signing_key:
210
218
  specification_version: 4
211
219
  summary: This gem adds a ttl to the session cookie of your application.
212
220
  test_files:
221
+ - spec/support/application_controller.rb
222
+ - spec/rails_helper.rb
213
223
  - spec/lib/frikandel/configuration_spec.rb
214
224
  - spec/spec_helper.rb
215
- - spec/controllers/bind_session_to_ip_address_controller_spec.rb
216
- - spec/controllers/combined_controller_spec.rb
217
- - spec/controllers/limit_session_lifetime_controller_spec.rb
218
- - spec/controllers/customized_on_invalid_session_controller_spec.rb
219
- - spec/support/application_controller.rb
220
- - spec/dummy/README.rdoc
221
- - spec/dummy/public/500.html
222
- - spec/dummy/public/favicon.ico
223
- - spec/dummy/public/422.html
224
- - spec/dummy/public/404.html
225
- - spec/dummy/config.ru
226
- - spec/dummy/log/test.log
225
+ - spec/dummy/app/assets/javascripts/application.js
226
+ - spec/dummy/app/assets/config/manifest.js
227
+ - spec/dummy/app/assets/stylesheets/application.css
228
+ - spec/dummy/app/views/layouts/application.html.erb
229
+ - spec/dummy/app/helpers/application_helper.rb
230
+ - spec/dummy/app/controllers/application_controller.rb
231
+ - spec/dummy/config/environment.rb
227
232
  - spec/dummy/config/boot.rb
228
- - spec/dummy/config/initializers/wrap_parameters.rb
233
+ - spec/dummy/config/database.yml
234
+ - spec/dummy/config/routes.rb
235
+ - spec/dummy/config/initializers/inflections.rb
229
236
  - spec/dummy/config/initializers/filter_parameter_logging.rb
230
- - spec/dummy/config/initializers/session_store.rb
237
+ - spec/dummy/config/initializers/backtrace_silencers.rb
231
238
  - spec/dummy/config/initializers/secret_token.rb
239
+ - spec/dummy/config/initializers/session_store.rb
232
240
  - spec/dummy/config/initializers/mime_types.rb
233
- - spec/dummy/config/initializers/backtrace_silencers.rb
234
- - spec/dummy/config/initializers/inflections.rb
241
+ - spec/dummy/config/initializers/wrap_parameters.rb
242
+ - spec/dummy/config/application.rb
235
243
  - spec/dummy/config/locales/en.yml
236
- - spec/dummy/config/routes.rb
237
- - spec/dummy/config/environment.rb
238
244
  - spec/dummy/config/environments/production.rb
239
- - spec/dummy/config/environments/test.rb
240
245
  - spec/dummy/config/environments/development.rb
241
- - spec/dummy/config/database.yml
242
- - spec/dummy/config/application.rb
246
+ - spec/dummy/config/environments/test.rb
247
+ - spec/dummy/Rakefile
248
+ - spec/dummy/config.ru
249
+ - spec/dummy/public/favicon.ico
250
+ - spec/dummy/public/404.html
251
+ - spec/dummy/public/422.html
252
+ - spec/dummy/public/500.html
253
+ - spec/dummy/README.rdoc
254
+ - spec/dummy/log/test.log
255
+ - spec/dummy/bin/rake
243
256
  - spec/dummy/bin/rails
244
257
  - spec/dummy/bin/bundle
245
- - spec/dummy/bin/rake
246
- - spec/dummy/app/assets/javascripts/application.js
247
- - spec/dummy/app/assets/stylesheets/application.css
248
- - spec/dummy/app/views/layouts/application.html.erb
249
- - spec/dummy/app/controllers/application_controller.rb
250
- - spec/dummy/app/helpers/application_helper.rb
251
- - spec/dummy/Rakefile
258
+ - spec/controllers/limit_session_lifetime_controller_spec.rb
259
+ - spec/controllers/customized_on_invalid_session_controller_spec.rb
260
+ - spec/controllers/bind_session_to_ip_address_controller_spec.rb
261
+ - spec/controllers/combined_controller_spec.rb
data/Gemfile.rails-4.1.x DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in frikandel.gemspec
4
- gemspec
5
-
6
- gem 'rails', '~> 4.1.0'