Sha256: b6365953c572905c91abe3cddcf6a3181362722d6dec7e9ec1b9fe85a8ba3f55
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
module HyperSpec module Internal module RailsControllerHelpers def self.included(base) base.include ControllerHelpers base.include Helpers routes = ::Rails.application.routes routes.disable_clear_and_finalize = true routes.clear! routes.draw { get "/#{base.route_root}/:id", to: "#{base.route_root}#test" } ::Rails.application.routes_reloader.paths.each { |path| load(path) } routes.finalize! ActiveSupport.on_load(:action_controller) { routes.finalize! } ensure routes.disable_clear_and_finalize = false end module Helpers def ping! head(:no_content) nil end def mount_component! @page << '<%= react_component @component_name, @component_params, '\ "{ prerender: #{@render_on != :client_only} } %>" end def application!(file) @page << "<%= javascript_include_tag '#{file}' %>" end def style_sheet!(file) @page << "<%= stylesheet_link_tag '#{file}' %>" end def deliver! @render_params[:inline] = @page response.headers['Cache-Control'] = 'max-age=120' response.headers['X-Tracking-ID'] = '123456' render @render_params end def server_only? @render_on == :server_only end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems