Sha256: 79b6086189fb5dac72f256e6be3329d3e1e38222f770d2ad2ee0bdfd684fafe5
Contents?: true
Size: 623 Bytes
Versions: 13
Compression:
Stored size: 623 Bytes
Contents
module Clapton module TestHelper module Base require "execjs" def render_component(component, **kwargs) js = File.read(File.join(__dir__, "..", "javascripts", "dist", "components.js")) Dir.glob(Rails.root.join("app", "components", "**", "*.rb")).each do |file| js += Ruby2JS.convert(File.read(file), preset: true) js += "\n" end context = ExecJS.compile(js) html = context.eval("new #{component.name.camelize}(#{kwargs.to_json}).render") @page = Capybara.string(html) end def page @page end end end end
Version data entries
13 entries across 13 versions & 1 rubygems