simple_workflow 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/History.rdoc +8 -1
- data/README.md +2 -1
- data/lib/simple_workflow/controller.rb +1 -5
- data/lib/simple_workflow/detour.rb +4 -0
- data/lib/simple_workflow/middleware.rb +1 -1
- data/lib/simple_workflow/version.rb +1 -1
- data/test/middleware_test.rb +12 -0
- data/test/test_app.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98730ae8a0dc257bc752e21b17522e68077937be
|
4
|
+
data.tar.gz: 4ba378f8a83519a7ac7cbf218dd7ead4c85c39ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0603ef92e165afcf6c7cc25cbc26f4a9ddfb34ab5e8f9a952dcc079377ce9dfbe27e7690880e30a838ff99f364f927aa45d39048f371625113495c54fc0d8762
|
7
|
+
data.tar.gz: 2608dc6a44158c2f4d780038882fe7984dd8f0502cecdf72be9f3feed8965b4e12660293e6cca6bf63da161f94841e11665853f939bc8be17c1fb134c1c2f600
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_workflow (1.1.
|
4
|
+
simple_workflow (1.1.1)
|
5
5
|
rails (~> 4.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -46,6 +46,7 @@ GEM
|
|
46
46
|
arel (6.0.3)
|
47
47
|
builder (3.2.2)
|
48
48
|
concurrent-ruby (1.0.1)
|
49
|
+
concurrent-ruby (1.0.1-java)
|
49
50
|
docile (1.1.5)
|
50
51
|
erubis (2.7.0)
|
51
52
|
globalid (0.3.6)
|
@@ -69,6 +70,7 @@ GEM
|
|
69
70
|
ruby-progressbar
|
70
71
|
nokogiri (1.6.7.2)
|
71
72
|
mini_portile2 (~> 2.0.0.rc2)
|
73
|
+
nokogiri (1.6.7.2-java)
|
72
74
|
rack (1.6.4)
|
73
75
|
rack-test (0.6.3)
|
74
76
|
rack (>= 1.0)
|
@@ -112,6 +114,7 @@ GEM
|
|
112
114
|
sprockets (>= 3.0.0)
|
113
115
|
thor (0.19.1)
|
114
116
|
thread_safe (0.3.5)
|
117
|
+
thread_safe (0.3.5-java)
|
115
118
|
tzinfo (1.2.2)
|
116
119
|
thread_safe (~> 0.1)
|
117
120
|
|
data/History.rdoc
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
simple_workflow
|
2
2
|
===============
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/simple_workflow.svg)](https://badge.fury.io/rb/simple_workflow)
|
4
5
|
[![Build Status](https://travis-ci.org/donv/simple_workflow.svg?branch=master)](https://travis-ci.org/donv/simple_workflow)
|
5
6
|
|
6
7
|
* http://github.com/donv/simple_workflow
|
@@ -58,7 +59,7 @@ or in Gemfile
|
|
58
59
|
|
59
60
|
(The MIT License)
|
60
61
|
|
61
|
-
Copyright (c) 2009-
|
62
|
+
Copyright (c) 2009-2016 Uwe Kubosch
|
62
63
|
|
63
64
|
Permission is hereby granted, free of charge, to any person obtaining
|
64
65
|
a copy of this software and associated documentation files (the
|
@@ -67,14 +67,10 @@ module SimpleWorkflow::Controller
|
|
67
67
|
return nil unless detours
|
68
68
|
detour = detours.pop
|
69
69
|
logger.debug "popped detour: #{detour.inspect} #{session[:detours].size} more"
|
70
|
-
reset_workflow if detours.empty?
|
70
|
+
reset_workflow(session) if detours.empty?
|
71
71
|
detour
|
72
72
|
end
|
73
73
|
|
74
|
-
def reset_workflow
|
75
|
-
session.delete(:detours)
|
76
|
-
end
|
77
|
-
|
78
74
|
def redirect_to_post(options)
|
79
75
|
url = url_for options
|
80
76
|
render :text => <<EOF, :layout => false
|
@@ -51,7 +51,7 @@ class SimpleWorkflow::Middleware
|
|
51
51
|
break unless ws >= 2048 || (ss >= 3072 && session[:detours] && session[:detours].size > 0)
|
52
52
|
Rails.logger.warn "Workflow too large (#{ws}/#{ss}). Dropping oldest detour."
|
53
53
|
session[:detours].shift
|
54
|
-
reset_workflow if session[:detours].empty?
|
54
|
+
reset_workflow(session) if session[:detours].empty?
|
55
55
|
end
|
56
56
|
Rails.logger.debug "session: #{ss} bytes, workflow(#{session[:detours].try(:size) || 0}): #{ws} bytes"
|
57
57
|
end
|
data/test/middleware_test.rb
CHANGED
@@ -60,6 +60,18 @@ class MiddlewareTest < MiniTest::Test
|
|
60
60
|
env['rack.session'].to_hash['detours'])
|
61
61
|
end
|
62
62
|
|
63
|
+
def test_huge_detour_over_4k
|
64
|
+
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"
|
65
|
+
env = env_for(query)
|
66
|
+
|
67
|
+
status, headers, response = @stack.call env
|
68
|
+
|
69
|
+
assert_equal 200, status
|
70
|
+
assert_equal(env, headers)
|
71
|
+
assert_equal 'app response', response
|
72
|
+
assert_equal(%w(session_id), headers['rack.session'].to_hash.keys)
|
73
|
+
end
|
74
|
+
|
63
75
|
private
|
64
76
|
|
65
77
|
def env_for(url, opts={})
|
data/test/test_app.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rails'
|
|
3
3
|
class TestApp < Rails::Application
|
4
4
|
config.action_dispatch.cookies_serializer = :json
|
5
5
|
config.action_dispatch.key_generator = ActiveSupport::KeyGenerator.new('secret')
|
6
|
-
config.logger = Logger.new('log/test.log')
|
6
|
+
config.logger = Logger.new(File.expand_path('../log/test.log', __dir__))
|
7
7
|
config.secret_key_base = 'secret key base'
|
8
8
|
# config.secret_token = 'secret token'
|
9
9
|
|