Class: CypressOnRails::StateResetMiddleware
- Inherits:
-
Object
- Object
- CypressOnRails::StateResetMiddleware
- Defined in:
- lib/cypress_on_rails/state_reset_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ StateResetMiddleware
constructor
A new instance of StateResetMiddleware.
Constructor Details
#initialize(app) ⇒ StateResetMiddleware
Returns a new instance of StateResetMiddleware.
3 4 5 |
# File 'lib/cypress_on_rails/state_reset_middleware.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/cypress_on_rails/state_reset_middleware.rb', line 7 def call(env) if env['PATH_INFO'] == '/__cypress__/reset_state' || env['PATH_INFO'] == '/cypress_rails_reset_state' reset_application_state [200, { 'Content-Type' => 'text/plain' }, ['State reset completed']] else @app.call(env) end end |