diff --git a/Rakefile b/Rakefile index ef00367..169d996 100644 --- a/Rakefile +++ b/Rakefile @@ -15,5 +15,5 @@ require 'rubocop/rake_task' RuboCop::RakeTask.new namespace :test do - task full: ['rubocop:auto_correct', :test] + task full: ['rubocop:autocorrect_all', :test] end diff --git a/lib/simple_workflow/helper.rb b/lib/simple_workflow/helper.rb index 8fe5456..a860438 100644 --- a/lib/simple_workflow/helper.rb +++ b/lib/simple_workflow/helper.rb @@ -44,7 +44,7 @@ def with_detour(options, origin = origin_options) end origin.update(origin_options) if origin.keys == [:anchor] url = url_for(options) - url + (/\?/.match?(url) ? '&' : '?') + origin.to_h.to_param('detour') + url + (url.include?('?') ? '&' : '?') + origin.to_h.to_param('detour') end def origin_options diff --git a/test/middleware_test.rb b/test/middleware_test.rb index eb1755b..d2576e9 100644 --- a/test/middleware_test.rb +++ b/test/middleware_test.rb @@ -23,7 +23,7 @@ def test_get_without_detour status, headers, response = @stack.call env assert_equal 200, status - assert_equal ['app response'], response + assert_equal ['app response'], [*response] assert_equal [], headers['rack.session'].to_hash.keys assert_nil headers['rack.session'].to_hash['detours'] end @@ -53,7 +53,7 @@ def test_detour_cleanup status, env, response = @stack.call last_env assert_equal 200, status - assert_equal ['app response'], response + assert_equal ['app response'], [*response] assert_equal(%w[session_id detours], env['rack.session'].to_hash.keys) assert_equal(((57..99).to_a + [:last]).map { |i| { 'controller' => "test_#{i}" } }, @@ -69,7 +69,7 @@ def test_huge_detour_over_4k status, headers, response = @stack.call env assert_equal 200, status - assert_equal ['app response'], response + assert_equal ['app response'], [*response] assert_equal(%w[session_id], headers['rack.session'].to_hash.keys) end @@ -82,7 +82,7 @@ def test_return_from_detour assert_equal 200, status assert_match(%r{_session_id=\w+--\w+; path=/; httponly}, headers['set-cookie']) - assert_equal ['app response'], response + assert_equal ['app response'], [*response] assert_equal ['session_id'], headers['rack.session'].to_hash.keys assert_nil headers['rack.session'].to_hash['detours'] end