lib/cypress_rails/middleware.rb in cypress_rails-0.4.2 vs lib/cypress_rails/middleware.rb in cypress_rails-0.5.0

- old
+ new

@@ -40,10 +40,18 @@ reset_db! end def execute_script!(request) body = JSON.parse(request.body.read) - CypressRails.scripts(body.fetch("name")).call + script = CypressRails.scripts(body.fetch("name")) + + params = body.fetch("params", {}) + + if params.any? + script.call(params) + else + script.call + end end def reset_db! CypressRails.configuration.before_each.call end