Sha256: ea0a54f0824a0bc1c981c764bfaa2eb458e019ea3f7f87966ce0db60bf962f62

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

class BootTestController < ApplicationController
  include ActionView::Helpers::AssetTagHelper

  skip_before_action :verify_authenticity_token, only: :user_script

  layout 'integration_test'

  def user_script
    if (delay = params[:delay])
      sleep delay.to_f
    end

    render body: <<~JS, content_type: 'text/javascript'
      console.log("hello from user script")
      up.compiler('body', function(body) {
        body.style.background = 'red'
      })
    JS
  end

  private

  helper_method def include_user_script(options = {})
    path = '/boot_test/user_script.js'
    if (delay = options.delete(:delay))
      path << "?delay=#{delay}"
    end
    javascript_include_tag(path, options)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/app/controllers/boot_test_controller.rb