Sha256: 5390282bb4e1cf0ea5b50df2502ebecc4d91bcb3ed581c3fc9b68d15ac394e95
Contents?: true
Size: 607 Bytes
Versions: 3
Compression:
Stored size: 607 Bytes
Contents
class JqueryMockjaxMiddleware def initialize app @app = app end def call env status, headers, response = @app.call(env) append_mockjaxes response [status, headers, response] end private def append_mockjaxes response if response.is_a? ActionDispatch::Response response.body = response.body.gsub!( /(<\/head>)/, %Q{ <script src='#{JqueryMockjaxRails.js_path}' type='text/javascript'></script> <script type='text/javascript'>#{JqueryMockjaxRails.js_output}</script>\\1 }.squish ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems