simple_workflow 2.0.0 → 2.0.1

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
2
  SHA256:
3
- metadata.gz: 4993c8e2332ed3f15e61401f237d0a6ae5ece68f6ec01a7e3ca76768dcecef99
4
- data.tar.gz: 4f47b26cc397e2aa98dbb144543e2f014c8d4eb9332ce9479309fc513d01123e
3
+ metadata.gz: 292e69a11faa0584c25618ffaa2bc2c2391e1b42d6e6e0503797fc3c94f6c2af
4
+ data.tar.gz: 2b57742db3c66f8b9b2edc088dcd8cabf848759556914abc4c3a329543a3e508
5
5
  SHA512:
6
- metadata.gz: 2e29e8b81b08ba503a1e9476f8a38f7fb39c79d7c58c62e82865d310e89790c04a07a0d7e633995c5d8066d6eeb379c2fdfcaebf52615be3d9d525c81b06cbf1
7
- data.tar.gz: a0f9d242235367349ef8da0af26b438c319c48e4ca8629ecee419d61af5d7f100ac8df92c01b8bef98fa6ddfd44a320b0cc0cd3f6db39fd66f4f64035df7e6ad
6
+ metadata.gz: 3c92b45c2959972fd8bb2d63c14357a10feadd9717268b233fed9bfad6d976c15f187ff3fb55e2737178240ac19ae462fcc96ddfc38db3588b737d3f7bf390e9
7
+ data.tar.gz: '0954579fb5d60a2be355f71f3cb32bb946eefbcfcf82705958008e1427da344b72a9c6b23c9d49749a323c6c830e2b2ba44d29011a6fa72170d869a1577fbf7b'
@@ -1,179 +1,186 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_workflow (2.0.0)
4
+ simple_workflow (2.0.1)
5
5
  rails (>= 4.2, < 6.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (6.0.2.1)
11
- actionpack (= 6.0.2.1)
10
+ actioncable (6.0.3.4)
11
+ actionpack (= 6.0.3.4)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailbox (6.0.2.1)
15
- actionpack (= 6.0.2.1)
16
- activejob (= 6.0.2.1)
17
- activerecord (= 6.0.2.1)
18
- activestorage (= 6.0.2.1)
19
- activesupport (= 6.0.2.1)
14
+ actionmailbox (6.0.3.4)
15
+ actionpack (= 6.0.3.4)
16
+ activejob (= 6.0.3.4)
17
+ activerecord (= 6.0.3.4)
18
+ activestorage (= 6.0.3.4)
19
+ activesupport (= 6.0.3.4)
20
20
  mail (>= 2.7.1)
21
- actionmailer (6.0.2.1)
22
- actionpack (= 6.0.2.1)
23
- actionview (= 6.0.2.1)
24
- activejob (= 6.0.2.1)
21
+ actionmailer (6.0.3.4)
22
+ actionpack (= 6.0.3.4)
23
+ actionview (= 6.0.3.4)
24
+ activejob (= 6.0.3.4)
25
25
  mail (~> 2.5, >= 2.5.4)
26
26
  rails-dom-testing (~> 2.0)
27
- actionpack (6.0.2.1)
28
- actionview (= 6.0.2.1)
29
- activesupport (= 6.0.2.1)
27
+ actionpack (6.0.3.4)
28
+ actionview (= 6.0.3.4)
29
+ activesupport (= 6.0.3.4)
30
30
  rack (~> 2.0, >= 2.0.8)
31
31
  rack-test (>= 0.6.3)
32
32
  rails-dom-testing (~> 2.0)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
- actiontext (6.0.2.1)
35
- actionpack (= 6.0.2.1)
36
- activerecord (= 6.0.2.1)
37
- activestorage (= 6.0.2.1)
38
- activesupport (= 6.0.2.1)
34
+ actiontext (6.0.3.4)
35
+ actionpack (= 6.0.3.4)
36
+ activerecord (= 6.0.3.4)
37
+ activestorage (= 6.0.3.4)
38
+ activesupport (= 6.0.3.4)
39
39
  nokogiri (>= 1.8.5)
40
- actionview (6.0.2.1)
41
- activesupport (= 6.0.2.1)
40
+ actionview (6.0.3.4)
41
+ activesupport (= 6.0.3.4)
42
42
  builder (~> 3.1)
43
43
  erubi (~> 1.4)
44
44
  rails-dom-testing (~> 2.0)
45
45
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
- activejob (6.0.2.1)
47
- activesupport (= 6.0.2.1)
46
+ activejob (6.0.3.4)
47
+ activesupport (= 6.0.3.4)
48
48
  globalid (>= 0.3.6)
49
- activemodel (6.0.2.1)
50
- activesupport (= 6.0.2.1)
51
- activerecord (6.0.2.1)
52
- activemodel (= 6.0.2.1)
53
- activesupport (= 6.0.2.1)
54
- activestorage (6.0.2.1)
55
- actionpack (= 6.0.2.1)
56
- activejob (= 6.0.2.1)
57
- activerecord (= 6.0.2.1)
49
+ activemodel (6.0.3.4)
50
+ activesupport (= 6.0.3.4)
51
+ activerecord (6.0.3.4)
52
+ activemodel (= 6.0.3.4)
53
+ activesupport (= 6.0.3.4)
54
+ activestorage (6.0.3.4)
55
+ actionpack (= 6.0.3.4)
56
+ activejob (= 6.0.3.4)
57
+ activerecord (= 6.0.3.4)
58
58
  marcel (~> 0.3.1)
59
- activesupport (6.0.2.1)
59
+ activesupport (6.0.3.4)
60
60
  concurrent-ruby (~> 1.0, >= 1.0.2)
61
61
  i18n (>= 0.7, < 2)
62
62
  minitest (~> 5.1)
63
63
  tzinfo (~> 1.1)
64
- zeitwerk (~> 2.2)
64
+ zeitwerk (~> 2.2, >= 2.2.2)
65
65
  ansi (1.5.0)
66
- ast (2.4.0)
66
+ ast (2.4.1)
67
67
  builder (3.2.4)
68
- concurrent-ruby (1.1.5)
69
- crass (1.0.5)
70
- docile (1.3.2)
71
- erubi (1.9.0)
68
+ concurrent-ruby (1.1.7)
69
+ crass (1.0.6)
70
+ docile (1.3.4)
71
+ erubi (1.10.0)
72
72
  globalid (0.4.2)
73
73
  activesupport (>= 4.2.0)
74
- i18n (1.7.0)
74
+ i18n (1.8.5)
75
75
  concurrent-ruby (~> 1.0)
76
- jaro_winkler (1.5.4)
77
- json (2.3.0)
78
- loofah (2.4.0)
76
+ loofah (2.8.0)
79
77
  crass (~> 1.0.2)
80
78
  nokogiri (>= 1.5.9)
81
79
  mail (2.7.1)
82
80
  mini_mime (>= 0.1.1)
83
81
  marcel (0.3.3)
84
82
  mimemagic (~> 0.3.2)
85
- method_source (0.9.2)
86
- mimemagic (0.3.3)
83
+ method_source (1.0.0)
84
+ mimemagic (0.3.5)
87
85
  mini_mime (1.0.2)
88
86
  mini_portile2 (2.4.0)
89
- minitest (5.13.0)
87
+ minitest (5.14.2)
90
88
  minitest-reporters (1.4.2)
91
89
  ansi
92
90
  builder
93
91
  minitest (>= 5.0)
94
92
  ruby-progressbar
95
- nio4r (2.5.2)
96
- nokogiri (1.10.7)
93
+ nio4r (2.5.4)
94
+ nokogiri (1.10.10)
97
95
  mini_portile2 (~> 2.4.0)
98
- parallel (1.19.1)
99
- parser (2.7.0.1)
100
- ast (~> 2.4.0)
101
- rack (2.0.8)
96
+ parallel (1.20.1)
97
+ parser (3.0.0.0)
98
+ ast (~> 2.4.1)
99
+ rack (2.2.3)
102
100
  rack-test (1.1.0)
103
101
  rack (>= 1.0, < 3)
104
- rails (6.0.2.1)
105
- actioncable (= 6.0.2.1)
106
- actionmailbox (= 6.0.2.1)
107
- actionmailer (= 6.0.2.1)
108
- actionpack (= 6.0.2.1)
109
- actiontext (= 6.0.2.1)
110
- actionview (= 6.0.2.1)
111
- activejob (= 6.0.2.1)
112
- activemodel (= 6.0.2.1)
113
- activerecord (= 6.0.2.1)
114
- activestorage (= 6.0.2.1)
115
- activesupport (= 6.0.2.1)
102
+ rails (6.0.3.4)
103
+ actioncable (= 6.0.3.4)
104
+ actionmailbox (= 6.0.3.4)
105
+ actionmailer (= 6.0.3.4)
106
+ actionpack (= 6.0.3.4)
107
+ actiontext (= 6.0.3.4)
108
+ actionview (= 6.0.3.4)
109
+ activejob (= 6.0.3.4)
110
+ activemodel (= 6.0.3.4)
111
+ activerecord (= 6.0.3.4)
112
+ activestorage (= 6.0.3.4)
113
+ activesupport (= 6.0.3.4)
116
114
  bundler (>= 1.3.0)
117
- railties (= 6.0.2.1)
115
+ railties (= 6.0.3.4)
118
116
  sprockets-rails (>= 2.0.0)
119
117
  rails-dom-testing (2.0.3)
120
118
  activesupport (>= 4.2.0)
121
119
  nokogiri (>= 1.6)
122
120
  rails-html-sanitizer (1.3.0)
123
121
  loofah (~> 2.3)
124
- railties (6.0.2.1)
125
- actionpack (= 6.0.2.1)
126
- activesupport (= 6.0.2.1)
122
+ railties (6.0.3.4)
123
+ actionpack (= 6.0.3.4)
124
+ activesupport (= 6.0.3.4)
127
125
  method_source
128
126
  rake (>= 0.8.7)
129
127
  thor (>= 0.20.3, < 2.0)
130
128
  rainbow (3.0.0)
131
- rake (13.0.1)
132
- rubocop (0.78.0)
133
- jaro_winkler (~> 1.5.1)
129
+ rake (13.0.3)
130
+ regexp_parser (2.0.3)
131
+ rexml (3.2.4)
132
+ rubocop (1.7.0)
134
133
  parallel (~> 1.10)
135
- parser (>= 2.6)
134
+ parser (>= 2.7.1.5)
136
135
  rainbow (>= 2.2.2, < 4.0)
136
+ regexp_parser (>= 1.8, < 3.0)
137
+ rexml
138
+ rubocop-ast (>= 1.2.0, < 2.0)
137
139
  ruby-progressbar (~> 1.7)
138
- unicode-display_width (>= 1.4.0, < 1.7)
139
- rubocop-performance (1.5.2)
140
- rubocop (>= 0.71.0)
141
- rubocop-rails (2.4.1)
140
+ unicode-display_width (>= 1.4.0, < 2.0)
141
+ rubocop-ast (1.3.0)
142
+ parser (>= 2.7.1.5)
143
+ rubocop-performance (1.9.2)
144
+ rubocop (>= 0.90.0, < 2.0)
145
+ rubocop-ast (>= 0.4.0)
146
+ rubocop-rails (2.9.1)
147
+ activesupport (>= 4.2.0)
142
148
  rack (>= 1.1)
143
- rubocop (>= 0.72.0)
144
- ruby-progressbar (1.10.1)
145
- simplecov (0.17.1)
149
+ rubocop (>= 0.90.0, < 2.0)
150
+ ruby-progressbar (1.11.0)
151
+ simplecov (0.20.0)
146
152
  docile (~> 1.1)
147
- json (>= 1.8, < 3)
148
- simplecov-html (~> 0.10.0)
149
- simplecov-html (0.10.2)
150
- sprockets (4.0.0)
153
+ simplecov-html (~> 0.11)
154
+ simplecov_json_formatter (~> 0.1)
155
+ simplecov-html (0.12.3)
156
+ simplecov_json_formatter (0.1.2)
157
+ sprockets (4.0.2)
151
158
  concurrent-ruby (~> 1.0)
152
159
  rack (> 1, < 3)
153
- sprockets-rails (3.2.1)
160
+ sprockets-rails (3.2.2)
154
161
  actionpack (>= 4.0)
155
162
  activesupport (>= 4.0)
156
163
  sprockets (>= 3.0.0)
157
164
  thor (1.0.1)
158
165
  thread_safe (0.3.6)
159
- tzinfo (1.2.6)
166
+ tzinfo (1.2.9)
160
167
  thread_safe (~> 0.1)
161
- unicode-display_width (1.6.0)
162
- websocket-driver (0.7.1)
168
+ unicode-display_width (1.7.0)
169
+ websocket-driver (0.7.3)
163
170
  websocket-extensions (>= 0.1.0)
164
- websocket-extensions (0.1.4)
165
- zeitwerk (2.2.2)
171
+ websocket-extensions (0.1.5)
172
+ zeitwerk (2.4.2)
166
173
 
167
174
  PLATFORMS
168
- ruby
175
+ x86_64-darwin-19
169
176
 
170
177
  DEPENDENCIES
171
178
  minitest-reporters (~> 1.0)
172
- rubocop (~> 0.49)
179
+ rubocop (~> 1.0)
173
180
  rubocop-performance (~> 1.5)
174
181
  rubocop-rails (~> 2.4)
175
182
  simple_workflow!
176
183
  simplecov (~> 0.9)
177
184
 
178
185
  BUNDLED WITH
179
- 1.17.3
186
+ 2.2.3
data/Rakefile CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rake'
4
4
  require 'rake/clean'
5
5
  require 'rake/testtask'
6
- require File.dirname(__FILE__) + '/lib/simple_workflow/version'
6
+ require "#{File.dirname(__FILE__)}/lib/simple_workflow/version"
7
7
 
8
8
  GEM_FILE = "simple_workflow-#{SimpleWorkflow::VERSION}.gem"
9
9
  GEM_SPEC_FILE = 'simple_workflow.gemspec'
@@ -31,6 +31,7 @@ module SimpleWorkflow::Controller
31
31
 
32
32
  def back(response_status_and_flash)
33
33
  return false if session[:detours].nil?
34
+
34
35
  detour = pop_detour(session)
35
36
  post = detour.delete(:request_method) == :post
36
37
  if post
@@ -58,6 +59,7 @@ module SimpleWorkflow::Controller
58
59
  end
59
60
 
60
61
  return unless (other_flashes = response_status_and_flash.delete(:flash))
62
+
61
63
  flash.update(other_flashes)
62
64
  end
63
65
  private :save_flash
@@ -71,6 +73,6 @@ module SimpleWorkflow::Controller
71
73
  </form>
72
74
  </body>
73
75
  </html>
74
- HTML
76
+ HTML
75
77
  end
76
78
  end
@@ -21,6 +21,7 @@ module SimpleWorkflow::Detour
21
21
  def pop_detour(session, origin_options = nil)
22
22
  detours = session[:detours]
23
23
  return nil unless detours
24
+
24
25
  detour = detours.delete(origin_options) || detours.pop
25
26
  Rails.logger.debug "popped detour: #{detour.inspect} #{session[:detours].size} more"
26
27
  reset_workflow(session) if detours.empty?
@@ -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 + (url =~ /\?/ ? '&' : '?') + origin.to_h.to_param('detour')
47
+ url + (/\?/.match?(url) ? '&' : '?') + origin.to_h.to_param('detour')
48
48
  end
49
49
 
50
50
  def origin_options
@@ -58,9 +58,10 @@ module SimpleWorkflow::Helper
58
58
  end
59
59
 
60
60
  def image_link_to(image_source, title, url_options, image_options = nil, link_options = nil)
61
- if link_options == true
61
+ case link_options
62
+ when true
62
63
  link_options = { method: :post }
63
- elsif link_options == false
64
+ when false
64
65
  link_options = nil
65
66
  end
66
67
  image_options ||= { class: 'image-submit' }
@@ -70,9 +71,10 @@ module SimpleWorkflow::Helper
70
71
 
71
72
  def image_link_to_remote(image_source, title, link_options, image_options = nil,
72
73
  html_options = {})
73
- if html_options == true
74
+ case html_options
75
+ when true
74
76
  html_options = { method: :post }
75
- elsif html_options == false
77
+ when false
76
78
  html_options = {}
77
79
  end
78
80
  image_options ||= { class: 'image-submit' }
@@ -43,6 +43,7 @@ class SimpleWorkflow::Middleware
43
43
 
44
44
  def remove_old_detours(env)
45
45
  return unless session(env).instance_variable_get('@by').is_a?(ActionDispatch::Session::CookieStore)
46
+
46
47
  session_size = workflow_size = nil
47
48
  session = session(env)
48
49
  cookie_jar = cookie_jar(env)
@@ -53,7 +54,8 @@ class SimpleWorkflow::Middleware
53
54
  wf_ser_val = serialize_session(cookie_jar, session[:detours])
54
55
  workflow_size = encryptor.encrypt_and_sign(wf_ser_val).size
55
56
  break unless workflow_size >= 2048 ||
56
- (session_size >= 3072 && session[:detours] && !session[:detours].empty?)
57
+ (session_size >= 3072 && session[:detours] && !session[:detours].empty?)
58
+
57
59
  Rails.logger.warn("Workflow too large (#{workflow_size}/#{session_size}). Dropping oldest detour.")
58
60
  session[:detours].shift
59
61
  reset_workflow(session) if session[:detours].empty?
@@ -62,6 +64,7 @@ class SimpleWorkflow::Middleware
62
64
  session: #{session_size} bytes, workflow(#{session[:detours].try(:size) || 0}): #{workflow_size} bytes
63
65
  MSG
64
66
  return unless session_size > 4096
67
+
65
68
  Rails.logger.warn <<-MSG.strip_heredoc
66
69
  simple_workflow: session exceeds cookie size limit: #{session_size} bytes. Workflow empty! Not My Fault!
67
70
  MSG
@@ -71,6 +74,7 @@ class SimpleWorkflow::Middleware
71
74
 
72
75
  def remove_discarded_flashes(session)
73
76
  return unless (old_flashes = session[:flash] && session[:flash]['discard'])
77
+
74
78
  Rails.logger.warn <<-MSG.strip_heredoc
75
79
  simple_workflow: found discarded flash entries: #{old_flashes}. Deleting them.
76
80
  MSG
@@ -90,8 +94,10 @@ class SimpleWorkflow::Middleware
90
94
 
91
95
  def encryptor(env)
92
96
  return @simple_workflow_encryptor if @simple_workflow_encryptor
97
+
93
98
  @simple_workflow_encryptor = cookie_jar(env).instance_variable_get(:@encryptor)
94
99
  return @simple_workflow_encryptor if @simple_workflow_encryptor
100
+
95
101
  Rails.logger.warn 'simple_workflow: Could not get encryptor from the cookie jar'
96
102
  secret_key_base = Rails.application.config.secret_key_base || Rails.application.config.secret_token ||
97
103
  SecureRandom.hex(64)
@@ -105,6 +111,7 @@ class SimpleWorkflow::Middleware
105
111
  def store_detour_from_params(env)
106
112
  store_detour_in_session(session(env), params(env)[:detour]) if params(env)[:detour]
107
113
  return unless params(env)[:return_from_detour] && session(env)[:detours]
114
+
108
115
  params_hash = params(env).to_h.reject { |k, _v| %i[detour return_from_detour].include? k.to_sym }
109
116
  pop_detour(session(env), params_hash)
110
117
  end
@@ -7,14 +7,14 @@ module SimpleWorkflow
7
7
  app.middleware.insert_before ActionDispatch::Flash, SimpleWorkflow::Middleware
8
8
 
9
9
  # Make workflow test utility methods available in views
10
- ActionView::Base.send :include, SimpleWorkflow::Helper
10
+ ActionView::Base.include SimpleWorkflow::Helper
11
11
 
12
12
  # Make workflow test utility methods available in controllers
13
- ActionController::Base.send :include, SimpleWorkflow::Helper
14
- ActionController::Base.send :include, SimpleWorkflow::Controller
13
+ ActionController::Base.include SimpleWorkflow::Helper
14
+ ActionController::Base.include SimpleWorkflow::Controller
15
15
 
16
16
  # Make workflow test utility methods available in ActiveSupport test cases
17
- ActiveSupport::TestCase.send :include, SimpleWorkflow::TestHelper
17
+ ActiveSupport::TestCase.include SimpleWorkflow::TestHelper
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleWorkflow
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
@@ -18,7 +18,7 @@ class ControllerTest < MiniTest::Test
18
18
  @session = {}
19
19
  @bad_route = false
20
20
  # TODO(uwe): Remove when we stop testing Rails 4.1
21
- Rails.app_class = TestApp if Rails.version !~ /^4\.1\./
21
+ Rails.app_class = TestApp unless /^4\.1\./.match?(Rails.version)
22
22
  # ODOT
23
23
  end
24
24
 
@@ -10,18 +10,24 @@ class HelperTest < MiniTest::Test
10
10
  def test_with_detour
11
11
  assert_equal '?detour%5Baction%5D=myaction&detour%5Bcontroller%5D=mycontroller&detour%5Bid%5D=42' \
12
12
  '&detour%5Bquery%5D%5Bnested%5D=criterium',
13
- with_detour('')
13
+ with_detour('')
14
14
  end
15
15
 
16
16
  def test_with_detour_with_origin
17
17
  assert_equal '?detour%5Baction%5D=index&detour%5Bcontroller%5D=dashboard',
18
- with_detour('', controller: :dashboard, action: :index)
18
+ with_detour('', controller: :dashboard, action: :index)
19
19
  end
20
20
 
21
21
  def test_with_detour_with_only_anchor_as_origin
22
22
  assert_equal '?detour%5Baction%5D=myaction&detour%5Banchor%5D=tab_2' \
23
23
  '&detour%5Bcontroller%5D=mycontroller&detour%5Bid%5D=42&detour%5Bquery%5D%5Bnested%5D=criterium',
24
- with_detour('', anchor: :tab_2)
24
+ with_detour('', anchor: :tab_2)
25
+ end
26
+
27
+ module SimpleWorkflow::Controller
28
+ def self.binary_params_for?(_action)
29
+ false
30
+ end
25
31
  end
26
32
 
27
33
  def test_with_detour_with_string_origin
@@ -33,7 +39,7 @@ class HelperTest < MiniTest::Test
33
39
 
34
40
  assert_equal '?detour%5Baction%5D=index&detour%5Banchor%5D=tab_2' \
35
41
  '&detour%5Bcontroller%5D=simple_workflow%2F&detour%5Bhullo%5D=1',
36
- with_detour('', '/dashboard/index?hullo=1#tab_2')
42
+ with_detour('', '/dashboard/index?hullo=1#tab_2')
37
43
  ensure
38
44
  Rails.application = nil
39
45
  end
@@ -45,7 +51,7 @@ class HelperTest < MiniTest::Test
45
51
  '&detour%5Bquery%5D%5Bnested%5D=criterium',
46
52
  { id: 'link_tag_id', title: 'Link title' },
47
53
  ],
48
- detour_to('Link Text', 'Link target', id: 'link_tag_id', title: 'Link title')
54
+ detour_to('Link Text', 'Link target', id: 'link_tag_id', title: 'Link title')
49
55
  end
50
56
 
51
57
  def test_image_button_to
@@ -56,26 +62,27 @@ class HelperTest < MiniTest::Test
56
62
  onclick: "form.action='{:id=>\"image_tag_id\"}'"
57
63
  }
58
64
  ],
59
- image_button_to('my_image.png', 'Link Title', { id: 'image_tag_id' }, title: 'Image title')
65
+ image_button_to('my_image.png', 'Link Title', { id: 'image_tag_id' },
66
+ title: 'Image title')
60
67
  end
61
68
 
62
69
  def test_image_link_to
63
70
  assert_equal [
64
71
  ['my_image.png', { title: 'Link Title', alt: 'Link Title' }], { id: 'image_tag_id' }, nil
65
72
  ],
66
- image_link_to('my_image.png', 'Link Title', { id: 'image_tag_id' }, title: 'Image title')
73
+ image_link_to('my_image.png', 'Link Title', { id: 'image_tag_id' }, title: 'Image title')
67
74
  end
68
75
 
69
76
  def test_back_or_link_to
70
77
  assert_equal ['Link title', { controller: :mycontroller, action: :my_action }, nil],
71
- back_or_link_to('Link title', controller: :mycontroller, action: :my_action)
78
+ back_or_link_to('Link title', controller: :mycontroller, action: :my_action)
72
79
  end
73
80
 
74
81
  def test_back_or_link_to_with_routing_error
75
82
  @session = { detours: [{ controller: :does_not_exist }] }
76
83
  @routing_error = ActionController::UrlGenerationError
77
84
  assert_equal ['Link title', { controller: :mycontroller, action: :my_action }, nil],
78
- back_or_link_to('Link title', controller: :mycontroller, action: :my_action)
85
+ back_or_link_to('Link title', controller: :mycontroller, action: :my_action)
79
86
  end
80
87
 
81
88
  private
@@ -87,7 +94,7 @@ class HelperTest < MiniTest::Test
87
94
  def params
88
95
  ActionController::Parameters.new(
89
96
  controller: 'mycontroller', action: 'myaction', id: 42, query: { nested: 'criterium' }
90
- )
97
+ )
91
98
  end
92
99
 
93
100
  def session
@@ -45,11 +45,13 @@ class MiddlewareTest < MiniTest::Test
45
45
  _, env, = @stack.call env_for('/?detour[controller]=test_first')
46
46
  (50..99).each do |i|
47
47
  next_env = env_for("/?detour[controller]=test_#{i}",
48
- 'rack.session' => env['rack.session'], 'rack.session.options' => env['rack.session.options'])
48
+ 'rack.session' => env['rack.session'],
49
+ 'rack.session.options' => env['rack.session.options'])
49
50
  _, env, = @stack.call next_env
50
51
  end
51
52
  last_env = env_for('/?detour[controller]=test_last',
52
- 'rack.session' => env['rack.session'], 'rack.session.options' => env['rack.session.options'])
53
+ 'rack.session' => env['rack.session'],
54
+ 'rack.session.options' => env['rack.session.options'])
53
55
  status, env, response = @stack.call last_env
54
56
 
55
57
  assert_equal 200, status
@@ -57,7 +59,7 @@ class MiddlewareTest < MiniTest::Test
57
59
  assert_equal(%w[session_id detours], env['rack.session'].to_hash.keys)
58
60
 
59
61
  assert_equal(((57..99).to_a + [:last]).map { |i| { 'controller' => "test_#{i}" } },
60
- env['rack.session'].to_hash['detours'])
62
+ env['rack.session'].to_hash['detours'])
61
63
  end
62
64
 
63
65
  def test_huge_detour_over_4k
@@ -77,8 +79,8 @@ class MiddlewareTest < MiniTest::Test
77
79
  def test_return_from_detour
78
80
  _, headers1, = @stack.call env_for('/?detour[controller]=test_first')
79
81
  env = env_for('/?return_from_detour=true',
80
- 'rack.session' => headers1['rack.session'],
81
- 'rack.session.options' => headers1['rack.session.options'])
82
+ 'rack.session' => headers1['rack.session'],
83
+ 'rack.session.options' => headers1['rack.session.options'])
82
84
  status, headers, response = @stack.call env
83
85
 
84
86
  assert_equal 200, status
@@ -99,7 +101,7 @@ class MiddlewareTest < MiniTest::Test
99
101
  ActionDispatch::Cookies::GENERATOR_KEY => ActiveSupport::KeyGenerator.new('secret'),
100
102
  ActionDispatch::Cookies::SECRET_KEY_BASE => 'secret',
101
103
  }
102
- if Rails.version =~ /^5\.2\./
104
+ if /^5\.2\./.match?(Rails.version)
103
105
  default_opts[ActionDispatch::Cookies::COOKIES_ROTATIONS] = Struct.new(:encrypted).new([])
104
106
  end
105
107
  Rack::MockRequest.env_for(url, default_opts.update(opts))
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.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.49'
53
+ version: '1.0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.49'
60
+ version: '1.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rubocop-performance
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -128,13 +128,13 @@ homepage: https://github.com/donv/simple_workflow
128
128
  licenses:
129
129
  - MIT
130
130
  metadata: {}
131
- post_install_message:
131
+ post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
135
135
  required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - "~>"
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '2.5'
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -143,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.0.3
147
- signing_key:
146
+ rubygems_version: 3.2.3
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: Add simple breadcrumbs "detour" workflow to Ruby On Rails.
150
150
  test_files: []