simple_workflow 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e889d098f3df6a6fb2b8616fe94dd78df26fcb39eefdbef76058f63243ea7009
4
- data.tar.gz: aca8036b62d9b076aeb7134957141c61bb31da1bf6e748c95f183dc6006cafb4
3
+ metadata.gz: b48b1e1e4e2c025d51b43bcd8800688bd5b34701e614477e59b31db2be525653
4
+ data.tar.gz: 102dd804824b1deac4b309b0150cd9149524be5926ff048c21479ec9c7ed2d98
5
5
  SHA512:
6
- metadata.gz: 7de279f421829e2aba3a9401ddf26925f9dad573f531753a562d7abd552bf0b2f65a487f8906d1335e5a40dadd6f45a3b72137be06a7378fa2f9bec9d8e1f0e5
7
- data.tar.gz: 3801dd96ab9190e4c2f008dc3c75e03a2f90b02459ffbb4517c1de8a92dee6505eebbe216a88434cb530d363114ae3042f6efe0c0f635fc1b5828b15750e65dd
6
+ metadata.gz: a99be761b12d1fe90b73b108fea8f4fb611dcf458c350c10158e70f05d4e2bfbc2c857069272c8cee498445b6d41e53cab73a4ea483f42c7f7f099a086ac072e
7
+ data.tar.gz: 7015168be5b0f6c000fa98415155f3e4dd6be1f2561e450c25b75c3b78835abec87a8bfae2bcb84d332fae4a645911a34fbf47c8b2cf72e8662a66d947830b71
data/Gemfile.lock CHANGED
@@ -1,188 +1,226 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_workflow (2.2.0)
5
- rails (>= 6.2, < 8)
4
+ simple_workflow (2.2.1)
5
+ rails (>= 6.1, < 8)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.2.2)
11
- actionpack (= 7.0.2.2)
12
- activesupport (= 7.0.2.2)
10
+ actioncable (7.1.3.4)
11
+ actionpack (= 7.1.3.4)
12
+ activesupport (= 7.1.3.4)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.2.2)
16
- actionpack (= 7.0.2.2)
17
- activejob (= 7.0.2.2)
18
- activerecord (= 7.0.2.2)
19
- activestorage (= 7.0.2.2)
20
- activesupport (= 7.0.2.2)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.3.4)
17
+ actionpack (= 7.1.3.4)
18
+ activejob (= 7.1.3.4)
19
+ activerecord (= 7.1.3.4)
20
+ activestorage (= 7.1.3.4)
21
+ activesupport (= 7.1.3.4)
21
22
  mail (>= 2.7.1)
22
23
  net-imap
23
24
  net-pop
24
25
  net-smtp
25
- actionmailer (7.0.2.2)
26
- actionpack (= 7.0.2.2)
27
- actionview (= 7.0.2.2)
28
- activejob (= 7.0.2.2)
29
- activesupport (= 7.0.2.2)
26
+ actionmailer (7.1.3.4)
27
+ actionpack (= 7.1.3.4)
28
+ actionview (= 7.1.3.4)
29
+ activejob (= 7.1.3.4)
30
+ activesupport (= 7.1.3.4)
30
31
  mail (~> 2.5, >= 2.5.4)
31
32
  net-imap
32
33
  net-pop
33
34
  net-smtp
34
- rails-dom-testing (~> 2.0)
35
- actionpack (7.0.2.2)
36
- actionview (= 7.0.2.2)
37
- activesupport (= 7.0.2.2)
38
- rack (~> 2.0, >= 2.2.0)
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.3.4)
37
+ actionview (= 7.1.3.4)
38
+ activesupport (= 7.1.3.4)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
39
43
  rack-test (>= 0.6.3)
40
- rails-dom-testing (~> 2.0)
41
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.2.2)
43
- actionpack (= 7.0.2.2)
44
- activerecord (= 7.0.2.2)
45
- activestorage (= 7.0.2.2)
46
- activesupport (= 7.0.2.2)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.3.4)
47
+ actionpack (= 7.1.3.4)
48
+ activerecord (= 7.1.3.4)
49
+ activestorage (= 7.1.3.4)
50
+ activesupport (= 7.1.3.4)
47
51
  globalid (>= 0.6.0)
48
52
  nokogiri (>= 1.8.5)
49
- actionview (7.0.2.2)
50
- activesupport (= 7.0.2.2)
53
+ actionview (7.1.3.4)
54
+ activesupport (= 7.1.3.4)
51
55
  builder (~> 3.1)
52
- erubi (~> 1.4)
53
- rails-dom-testing (~> 2.0)
54
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.2.2)
56
- activesupport (= 7.0.2.2)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.3.4)
60
+ activesupport (= 7.1.3.4)
57
61
  globalid (>= 0.3.6)
58
- activemodel (7.0.2.2)
59
- activesupport (= 7.0.2.2)
60
- activerecord (7.0.2.2)
61
- activemodel (= 7.0.2.2)
62
- activesupport (= 7.0.2.2)
63
- activestorage (7.0.2.2)
64
- actionpack (= 7.0.2.2)
65
- activejob (= 7.0.2.2)
66
- activerecord (= 7.0.2.2)
67
- activesupport (= 7.0.2.2)
62
+ activemodel (7.1.3.4)
63
+ activesupport (= 7.1.3.4)
64
+ activerecord (7.1.3.4)
65
+ activemodel (= 7.1.3.4)
66
+ activesupport (= 7.1.3.4)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.3.4)
69
+ actionpack (= 7.1.3.4)
70
+ activejob (= 7.1.3.4)
71
+ activerecord (= 7.1.3.4)
72
+ activesupport (= 7.1.3.4)
68
73
  marcel (~> 1.0)
69
- mini_mime (>= 1.1.0)
70
- activesupport (7.0.2.2)
74
+ activesupport (7.1.3.4)
75
+ base64
76
+ bigdecimal
71
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
72
80
  i18n (>= 1.6, < 2)
73
81
  minitest (>= 5.1)
82
+ mutex_m
74
83
  tzinfo (~> 2.0)
75
84
  ast (2.4.2)
76
- builder (3.2.4)
77
- concurrent-ruby (1.1.9)
85
+ base64 (0.2.0)
86
+ bigdecimal (3.1.8)
87
+ builder (3.3.0)
88
+ concurrent-ruby (1.3.2)
89
+ connection_pool (2.4.1)
78
90
  crass (1.0.6)
79
- digest (3.1.0)
91
+ date (3.3.4)
80
92
  docile (1.4.0)
81
- erubi (1.10.0)
82
- globalid (1.0.0)
83
- activesupport (>= 5.0)
84
- i18n (1.10.0)
93
+ drb (2.2.1)
94
+ erubi (1.12.0)
95
+ globalid (1.2.1)
96
+ activesupport (>= 6.1)
97
+ i18n (1.14.5)
85
98
  concurrent-ruby (~> 1.0)
86
- io-wait (0.2.1)
87
- loofah (2.14.0)
99
+ io-console (0.7.2)
100
+ irb (1.13.1)
101
+ rdoc (>= 4.0.0)
102
+ reline (>= 0.4.2)
103
+ json (2.7.2)
104
+ language_server-protocol (3.17.0.3)
105
+ loofah (2.22.0)
88
106
  crass (~> 1.0.2)
89
- nokogiri (>= 1.5.9)
90
- mail (2.7.1)
107
+ nokogiri (>= 1.12.0)
108
+ mail (2.8.1)
91
109
  mini_mime (>= 0.1.1)
92
- marcel (1.0.2)
93
- method_source (1.0.0)
94
- mini_mime (1.1.2)
95
- minitest (5.15.0)
96
- net-imap (0.2.3)
97
- digest
110
+ net-imap
111
+ net-pop
112
+ net-smtp
113
+ marcel (1.0.4)
114
+ mini_mime (1.1.5)
115
+ mini_portile2 (2.8.7)
116
+ minitest (5.23.1)
117
+ mutex_m (0.2.0)
118
+ net-imap (0.4.12)
119
+ date
98
120
  net-protocol
99
- strscan
100
- net-pop (0.1.1)
101
- digest
121
+ net-pop (0.1.2)
102
122
  net-protocol
123
+ net-protocol (0.2.2)
103
124
  timeout
104
- net-protocol (0.1.2)
105
- io-wait
106
- timeout
107
- net-smtp (0.3.1)
108
- digest
125
+ net-smtp (0.5.0)
109
126
  net-protocol
110
- timeout
111
- nio4r (2.5.8)
112
- nokogiri (1.13.3-x86_64-darwin)
127
+ nio4r (2.7.3)
128
+ nokogiri (1.16.5)
129
+ mini_portile2 (~> 2.8.2)
113
130
  racc (~> 1.4)
114
- parallel (1.21.0)
115
- parser (3.1.1.0)
131
+ parallel (1.25.1)
132
+ parser (3.3.2.0)
116
133
  ast (~> 2.4.1)
117
- racc (1.6.0)
118
- rack (2.2.3)
119
- rack-test (1.1.0)
120
- rack (>= 1.0, < 3)
121
- rails (7.0.2.2)
122
- actioncable (= 7.0.2.2)
123
- actionmailbox (= 7.0.2.2)
124
- actionmailer (= 7.0.2.2)
125
- actionpack (= 7.0.2.2)
126
- actiontext (= 7.0.2.2)
127
- actionview (= 7.0.2.2)
128
- activejob (= 7.0.2.2)
129
- activemodel (= 7.0.2.2)
130
- activerecord (= 7.0.2.2)
131
- activestorage (= 7.0.2.2)
132
- activesupport (= 7.0.2.2)
134
+ racc
135
+ psych (5.1.2)
136
+ stringio
137
+ racc (1.8.0)
138
+ rack (3.0.11)
139
+ rack-session (2.0.0)
140
+ rack (>= 3.0.0)
141
+ rack-test (2.1.0)
142
+ rack (>= 1.3)
143
+ rackup (2.1.0)
144
+ rack (>= 3)
145
+ webrick (~> 1.8)
146
+ rails (7.1.3.4)
147
+ actioncable (= 7.1.3.4)
148
+ actionmailbox (= 7.1.3.4)
149
+ actionmailer (= 7.1.3.4)
150
+ actionpack (= 7.1.3.4)
151
+ actiontext (= 7.1.3.4)
152
+ actionview (= 7.1.3.4)
153
+ activejob (= 7.1.3.4)
154
+ activemodel (= 7.1.3.4)
155
+ activerecord (= 7.1.3.4)
156
+ activestorage (= 7.1.3.4)
157
+ activesupport (= 7.1.3.4)
133
158
  bundler (>= 1.15.0)
134
- railties (= 7.0.2.2)
135
- rails-dom-testing (2.0.3)
136
- activesupport (>= 4.2.0)
159
+ railties (= 7.1.3.4)
160
+ rails-dom-testing (2.2.0)
161
+ activesupport (>= 5.0.0)
162
+ minitest
137
163
  nokogiri (>= 1.6)
138
- rails-html-sanitizer (1.4.2)
139
- loofah (~> 2.3)
140
- railties (7.0.2.2)
141
- actionpack (= 7.0.2.2)
142
- activesupport (= 7.0.2.2)
143
- method_source
164
+ rails-html-sanitizer (1.6.0)
165
+ loofah (~> 2.21)
166
+ nokogiri (~> 1.14)
167
+ railties (7.1.3.4)
168
+ actionpack (= 7.1.3.4)
169
+ activesupport (= 7.1.3.4)
170
+ irb
171
+ rackup (>= 1.0.0)
144
172
  rake (>= 12.2)
145
- thor (~> 1.0)
146
- zeitwerk (~> 2.5)
173
+ thor (~> 1.0, >= 1.2.2)
174
+ zeitwerk (~> 2.6)
147
175
  rainbow (3.1.1)
148
- rake (13.0.6)
149
- regexp_parser (2.2.1)
150
- rexml (3.2.5)
151
- rubocop (1.25.1)
176
+ rake (13.2.1)
177
+ rdoc (6.7.0)
178
+ psych (>= 4.0.0)
179
+ regexp_parser (2.9.2)
180
+ reline (0.5.8)
181
+ io-console (~> 0.5)
182
+ rexml (3.2.9)
183
+ strscan
184
+ rubocop (1.64.1)
185
+ json (~> 2.3)
186
+ language_server-protocol (>= 3.17.0)
152
187
  parallel (~> 1.10)
153
- parser (>= 3.1.0.0)
188
+ parser (>= 3.3.0.2)
154
189
  rainbow (>= 2.2.2, < 4.0)
155
190
  regexp_parser (>= 1.8, < 3.0)
156
- rexml
157
- rubocop-ast (>= 1.15.1, < 2.0)
191
+ rexml (>= 3.2.5, < 4.0)
192
+ rubocop-ast (>= 1.31.1, < 2.0)
158
193
  ruby-progressbar (~> 1.7)
159
- unicode-display_width (>= 1.4.0, < 3.0)
160
- rubocop-ast (1.16.0)
161
- parser (>= 3.1.1.0)
162
- rubocop-performance (1.13.2)
163
- rubocop (>= 1.7.0, < 2.0)
164
- rubocop-ast (>= 0.4.0)
165
- rubocop-rails (2.13.2)
194
+ unicode-display_width (>= 2.4.0, < 3.0)
195
+ rubocop-ast (1.31.3)
196
+ parser (>= 3.3.1.0)
197
+ rubocop-performance (1.21.0)
198
+ rubocop (>= 1.48.1, < 2.0)
199
+ rubocop-ast (>= 1.31.1, < 2.0)
200
+ rubocop-rails (2.25.0)
166
201
  activesupport (>= 4.2.0)
167
202
  rack (>= 1.1)
168
- rubocop (>= 1.7.0, < 2.0)
169
- ruby-progressbar (1.11.0)
170
- simplecov (0.21.2)
203
+ rubocop (>= 1.33.0, < 2.0)
204
+ rubocop-ast (>= 1.31.1, < 2.0)
205
+ ruby-progressbar (1.13.0)
206
+ simplecov (0.22.0)
171
207
  docile (~> 1.1)
172
208
  simplecov-html (~> 0.11)
173
209
  simplecov_json_formatter (~> 0.1)
174
210
  simplecov-html (0.12.3)
175
211
  simplecov_json_formatter (0.1.4)
176
- strscan (3.0.1)
177
- thor (1.2.1)
178
- timeout (0.2.0)
179
- tzinfo (2.0.4)
212
+ stringio (3.1.0)
213
+ strscan (3.1.0)
214
+ thor (1.3.1)
215
+ timeout (0.4.1)
216
+ tzinfo (2.0.6)
180
217
  concurrent-ruby (~> 1.0)
181
- unicode-display_width (2.1.0)
182
- websocket-driver (0.7.5)
218
+ unicode-display_width (2.5.0)
219
+ webrick (1.8.1)
220
+ websocket-driver (0.7.6)
183
221
  websocket-extensions (>= 0.1.0)
184
222
  websocket-extensions (0.1.5)
185
- zeitwerk (2.5.4)
223
+ zeitwerk (2.6.15)
186
224
 
187
225
  PLATFORMS
188
226
  ruby
@@ -195,4 +233,4 @@ DEPENDENCIES
195
233
  simplecov (~> 0.9)
196
234
 
197
235
  BUNDLED WITH
198
- 2.3.5
236
+ 2.3.8
data/README.md CHANGED
@@ -2,7 +2,7 @@ simple_workflow
2
2
  ===============
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/simple_workflow.svg)](https://badge.fury.io/rb/simple_workflow)
5
- [![Build Status](https://travis-ci.org/donv/simple_workflow.svg?branch=master)](https://travis-ci.org/donv/simple_workflow)
5
+ [![Test](https://github.com/donv/simple_workflow/actions/workflows/test.yml/badge.svg)](https://github.com/donv/simple_workflow/actions/workflows/test.yml)
6
6
 
7
7
  * http://github.com/donv/simple_workflow
8
8
  * http://rubydoc.info/gems/simple_workflow
data/Rakefile CHANGED
@@ -1,35 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rake'
4
- require 'rake/clean'
5
- require 'rake/testtask'
6
- require "#{File.dirname(__FILE__)}/lib/simple_workflow/version"
7
-
8
- GEM_FILE = "simple_workflow-#{SimpleWorkflow::VERSION}.gem"
9
- GEM_SPEC_FILE = 'simple_workflow.gemspec'
10
-
11
- CLEAN.include('simple_workflow-*.gem', 'tmp')
3
+ require 'bundler/gem_tasks'
12
4
 
13
5
  task default: :test
14
6
 
15
- desc 'Generate a gem'
16
- task gem: GEM_FILE
17
-
18
- file(GEM_FILE => GEM_SPEC_FILE) do
19
- puts "Generating #{GEM_FILE}"
20
- `gem build #{GEM_SPEC_FILE}`
21
- end
22
-
23
- desc 'Push the gem to RubyGems'
24
- task release: :gem do
25
- output = `git status --porcelain`
26
- raise "Workspace not clean!\n#{output}" unless output.empty?
27
-
28
- sh "git tag #{SimpleWorkflow::VERSION}"
29
- sh 'git push --tags'
30
- sh "gem push #{GEM_FILE}"
31
- end
32
-
7
+ require 'rake/testtask'
33
8
  Rake::TestTask.new do |t|
34
9
  t.libs << 'test'
35
10
  t.test_files = FileList['test/*_test.rb']
@@ -38,4 +13,7 @@ end
38
13
 
39
14
  require 'rubocop/rake_task'
40
15
  RuboCop::RakeTask.new
41
- Rake::Task[:test].enhance ['rubocop:auto_correct']
16
+
17
+ namespace :test do
18
+ task full: ['rubocop:autocorrect_all', :test]
19
+ end
@@ -66,7 +66,7 @@ module SimpleWorkflow::Controller
66
66
 
67
67
  def redirect_to_post(options)
68
68
  url = url_for options
69
- render text: <<~HTML.strip_heredoc, layout: false
69
+ render text: <<~HTML, layout: false
70
70
  <html>
71
71
  <body onload="document.getElementById('form').submit()">
72
72
  <form id="form" action="#{url}" method="POST">
@@ -44,7 +44,7 @@ module SimpleWorkflow::Helper
44
44
  end
45
45
  origin.update(origin_options) if origin.keys == [:anchor]
46
46
  url = url_for(options)
47
- url + (/\?/.match?(url) ? '&' : '?') + origin.to_h.to_param('detour')
47
+ url + (url.include?('?') ? '&' : '?') + origin.to_h.to_param('detour')
48
48
  end
49
49
 
50
50
  def origin_options
@@ -14,9 +14,9 @@ class SimpleWorkflow::Middleware
14
14
 
15
15
  def call(env)
16
16
  store_detour_from_params(env)
17
- status, headers, response = @app.call(env)
17
+ status, headers, body = @app.call(env)
18
18
  remove_old_detours(env)
19
- [status, headers, response]
19
+ [status, headers, body]
20
20
  end
21
21
 
22
22
  private
@@ -60,12 +60,12 @@ class SimpleWorkflow::Middleware
60
60
  session[:detours].shift
61
61
  reset_workflow(session) if session[:detours].empty?
62
62
  end
63
- Rails.logger.debug <<-MSG.strip_heredoc
63
+ Rails.logger.debug { <<~MSG }
64
64
  session: #{session_size} bytes, workflow(#{session[:detours].try(:size) || 0}): #{workflow_size} bytes
65
65
  MSG
66
66
  return unless session_size > 4096
67
67
 
68
- Rails.logger.warn <<-MSG.strip_heredoc
68
+ Rails.logger.warn <<~MSG
69
69
  simple_workflow: session exceeds cookie size limit: #{session_size} bytes. Workflow empty! Not My Fault!
70
70
  MSG
71
71
  Rails.logger.warn "simple_workflow: session: #{session.to_hash}"
@@ -75,20 +75,20 @@ class SimpleWorkflow::Middleware
75
75
  def remove_discarded_flashes(session)
76
76
  return unless (old_flashes = session[:flash] && session[:flash]['discard'])
77
77
 
78
- Rails.logger.warn <<-MSG.strip_heredoc
78
+ Rails.logger.warn <<~MSG
79
79
  simple_workflow: found discarded flash entries: #{old_flashes}. Deleting them.
80
80
  MSG
81
81
  session[:flash]['flashes'] = session[:flash]['flashes'].except(*old_flashes)
82
82
  Rails.logger.warn "simple_workflow: session: #{session.to_hash}"
83
83
  end
84
84
 
85
- if ActionPack::VERSION::MAJOR >= 5
85
+ if ActionPack::VERSION::MAJOR >= 7
86
86
  def serialize_session(cookie_jar, session)
87
- cookie_jar.send(:serialize, session)
87
+ cookie_jar.send(:serializer).send(:dump, session)
88
88
  end
89
- else # Rails 4.x
89
+ else # Rails 6
90
90
  def serialize_session(cookie_jar, session)
91
- cookie_jar.send(:serialize, nil, session)
91
+ cookie_jar.send(:serialize, session)
92
92
  end
93
93
  end
94
94
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleWorkflow
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rake'
4
3
  require './lib/simple_workflow/version'
5
4
  require 'date'
6
5
 
@@ -12,11 +11,11 @@ Gem::Specification.new do |s|
12
11
  s.summary = 'Add simple breadcrumbs "detour" workflow to Ruby On Rails.'
13
12
  s.homepage = 'https://github.com/donv/simple_workflow'
14
13
  s.description = 'Expands Ruby on Rails to allow simple breadcrumb detour workflows.'
15
- s.required_ruby_version = '>= 2.5', '<4'
14
+ s.required_ruby_version = '~> 3.1'
16
15
  s.licenses = %w[MIT]
17
- s.files = FileList['[A-Z]*', 'lib/**/*', 'test/**/*'].to_a
16
+ s.files = Dir['[A-Z]*', 'lib/**/*', 'test/**/*']
18
17
 
19
- s.add_runtime_dependency('rails', '>=6.2', '<8')
18
+ s.add_runtime_dependency('rails', '>=6.1', '<8')
20
19
 
21
20
  s.add_development_dependency('rubocop', '~>1.0')
22
21
  s.add_development_dependency('rubocop-performance', '~>1.5')
@@ -3,7 +3,7 @@
3
3
  require_relative 'test_helper'
4
4
  require 'rails'
5
5
 
6
- class ControllerTest < MiniTest::Test
6
+ class ControllerTest < Minitest::Test
7
7
  include SimpleWorkflow::Controller
8
8
  attr_accessor :cookies, :logger, :session
9
9
 
data/test/helper_test.rb CHANGED
@@ -4,7 +4,7 @@ require_relative 'test_helper'
4
4
  require 'action_controller/metal/exceptions'
5
5
  require 'test_app'
6
6
 
7
- class HelperTest < MiniTest::Test
7
+ class HelperTest < Minitest::Test
8
8
  include SimpleWorkflow::Helper
9
9
 
10
10
  def test_with_detour
@@ -4,7 +4,7 @@ require_relative 'test_helper'
4
4
  require 'simple_workflow/middleware'
5
5
  require_relative 'test_app'
6
6
 
7
- class MiddlewareTest < MiniTest::Test
7
+ class MiddlewareTest < Minitest::Test
8
8
  def setup
9
9
  @app = TestApp.instance
10
10
  # @app = ->(env) { [200, env, 'app response'] }
@@ -20,11 +20,10 @@ class MiddlewareTest < MiniTest::Test
20
20
  def test_get_without_detour
21
21
  env = env_for('/')
22
22
 
23
- status, headers, response = @stack.call env
23
+ status, headers, body = @stack.call env
24
24
 
25
25
  assert_equal 200, status
26
- assert_equal env, headers
27
- assert_equal 'app response', response
26
+ assert_equal ['app response'], [*body]
28
27
  assert_equal [], headers['rack.session'].to_hash.keys
29
28
  assert_nil headers['rack.session'].to_hash['detours']
30
29
  end
@@ -32,11 +31,10 @@ class MiddlewareTest < MiniTest::Test
32
31
  def test_detour
33
32
  env = env_for('/?detour[controller]=test')
34
33
 
35
- status, headers, response = @stack.call env
34
+ status, headers, body = @stack.call(env)
36
35
 
37
36
  assert_equal 200, status
38
- assert_equal(env, headers)
39
- assert_equal 'app response', response
37
+ assert_equal ['app response'], [*body]
40
38
  assert_equal(%w[session_id detours], headers['rack.session'].to_hash.keys)
41
39
  assert_equal([{ 'controller' => 'test' }], headers['rack.session'].to_hash['detours'])
42
40
  end
@@ -52,10 +50,10 @@ class MiddlewareTest < MiniTest::Test
52
50
  last_env = env_for('/?detour[controller]=test_last',
53
51
  'rack.session' => env['rack.session'],
54
52
  'rack.session.options' => env['rack.session.options'])
55
- status, env, response = @stack.call last_env
53
+ status, env, body = @stack.call last_env
56
54
 
57
55
  assert_equal 200, status
58
- assert_equal 'app response', response
56
+ assert_equal ['app response'], [*body]
59
57
  assert_equal(%w[session_id detours], env['rack.session'].to_hash.keys)
60
58
 
61
59
  assert_equal(((57..99).to_a + [:last]).map { |i| { 'controller' => "test_#{i}" } },
@@ -63,16 +61,15 @@ class MiddlewareTest < MiniTest::Test
63
61
  end
64
62
 
65
63
  def test_huge_detour_over_4k
66
- # rubocop:disable Metrics/LineLength
64
+ # rubocop:disable Layout/LineLength
67
65
  query = "/orders/TeYphD2wcYyBDFaKTnmAog/edit?detour%5Baction%5D=index&detour%5Bcommit%5D=Search&detour%5Bcontroller%5D=order_drilldown&detour%5Bdrilldown_search%5D%5Bdimensions%5D%5B%5D=arrival&detour%5Bdrilldown_search%5D%5Bdimensions%5D%5B%5D=delay&detour%5Bdrilldown_search%5D%5Bdisplay_type%5D=NONE&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bactual_time%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bcomments%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdelay%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdescription%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdirection%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bdrop_off_stand%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bestimated%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bfirst_vehicle%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bofb%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bonb%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Boperation%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bpick_up%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bpick_up_stand%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bplanned%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bprobable%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bscheduled%5D=1&detour%5Bdrilldown_search%5D%5Bfields%5D%5Bsta%5D=0&detour%5Bdrilldown_search%5D%5Bfields%5D%5Btime%5D=0&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Barrival%5D%5B%5D=Arrival&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Barrival%5D%5B%5D=Departure&detour%5Bdrilldown_search%5D%5Bfilter%5D%5Bcalendar_date%5D%5B%5D=2016-03-01&detour%5Bdrilldown_search%5D%5Blist%5D=1&detour%5Bdrilldown_search%5D%5Blist_change_times%5D=0&detour%5Bdrilldown_search%5D%5Border_by_value%5D=0&detour%5Bdrilldown_search%5D%5Bpercent%5D=1&detour%5Bdrilldown_search%5D%5Bselect_value%5D=COUNT&detour%5Bdrilldown_search%5D%5Btitle%5D=OSL+Daily+Delay+Report+2016-04-16#{'+etc' * 200}&detour%5Butf8%5D=%E2%9C%93"
68
- # rubocop:enable Metrics/LineLength
66
+ # rubocop:enable Layout/LineLength
69
67
  env = env_for(query)
70
68
 
71
69
  status, headers, response = @stack.call env
72
70
 
73
71
  assert_equal 200, status
74
- assert_equal(env, headers)
75
- assert_equal 'app response', response
72
+ assert_equal ['app response'], [*response]
76
73
  assert_equal(%w[session_id], headers['rack.session'].to_hash.keys)
77
74
  end
78
75
 
@@ -84,8 +81,10 @@ class MiddlewareTest < MiniTest::Test
84
81
  status, headers, response = @stack.call env
85
82
 
86
83
  assert_equal 200, status
87
- assert_equal env, headers
88
- assert_equal 'app response', response
84
+ if headers['set-cookie']
85
+ assert_match(%r{_session_id=\w+--\w+; path=/; httponly}, headers['set-cookie'])
86
+ end
87
+ assert_equal ['app response'], [*response]
89
88
  assert_equal ['session_id'], headers['rack.session'].to_hash.keys
90
89
  assert_nil headers['rack.session'].to_hash['detours']
91
90
  end
@@ -101,9 +100,6 @@ class MiddlewareTest < MiniTest::Test
101
100
  ActionDispatch::Cookies::GENERATOR_KEY => ActiveSupport::KeyGenerator.new('secret'),
102
101
  ActionDispatch::Cookies::SECRET_KEY_BASE => 'secret',
103
102
  }
104
- if /^5\.2\./.match?(Rails.version)
105
- default_opts[ActionDispatch::Cookies::COOKIES_ROTATIONS] = Struct.new(:encrypted).new([])
106
- end
107
103
  Rack::MockRequest.env_for(url, default_opts.update(opts))
108
104
  end
109
105
  end
data/test/test_helper.rb CHANGED
@@ -5,7 +5,7 @@ require 'bundler/setup'
5
5
  require 'simplecov'
6
6
  SimpleCov.start do
7
7
  coverage_dir File.expand_path('../coverage', File.dirname(__FILE__))
8
- minimum_coverage 76
8
+ minimum_coverage 75
9
9
  end
10
10
  require 'minitest/autorun'
11
11
  require 'rails'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2024-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.2'
19
+ version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '6.2'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -122,19 +122,16 @@ require_paths:
122
122
  - lib
123
123
  required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '2.5'
128
- - - "<"
125
+ - - "~>"
129
126
  - !ruby/object:Gem::Version
130
- version: '4'
127
+ version: '3.1'
131
128
  required_rubygems_version: !ruby/object:Gem::Requirement
132
129
  requirements:
133
130
  - - ">="
134
131
  - !ruby/object:Gem::Version
135
132
  version: '0'
136
133
  requirements: []
137
- rubygems_version: 3.3.7
134
+ rubygems_version: 3.5.9
138
135
  signing_key:
139
136
  specification_version: 4
140
137
  summary: Add simple breadcrumbs "detour" workflow to Ruby On Rails.