diff options
author | Matthew Draper <matthew@trebex.net> | 2016-02-22 11:55:52 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-03-02 02:14:20 +1030 |
commit | d3c9d808e3e242155a44fd2a89ef272cfade8fe8 (patch) | |
tree | f24199aec76f44fa8b6536c0664382672ad10e10 /actionpack/lib/action_dispatch/testing | |
parent | 664a13e6fb8281107da0da75e7cd91bba1425f76 (diff) | |
download | rails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.tar.gz rails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.tar.bz2 rails-d3c9d808e3e242155a44fd2a89ef272cfade8fe8.zip |
Publish AS::Executor and AS::Reloader APIs
These should allow external code to run blocks of user code to do
"work", at a similar unit size to a web request, without needing to get
intimate with ActionDipatch.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index f4534b4173..e871ddd289 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -455,17 +455,24 @@ module ActionDispatch def before_setup # :nodoc: @app = nil @integration_session = nil + @execution_context = nil + super + end + + def after_teardown # :nodoc: + remove! super end def integration_session - @integration_session ||= create_session(app) + @integration_session ||= create_session(app).tap { @execution_context = app.respond_to?(:executor) && app.executor.run! } end # Reset the current session. This is useful for testing multiple sessions # in a single test case. def reset! - @integration_session = create_session(app) + remove! + integration_session end def create_session(app) @@ -481,6 +488,8 @@ module ActionDispatch end def remove! # :nodoc: + @execution_context.complete! if @execution_context + @execution_context = nil @integration_session = nil end |