Sha256: cb30ec79dcc61e0b1cbe83e081fbac82cbc05b7d85d581313c45cddfb8e81800

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

#Load all the test files in ./user_compiler/*.js

Dir.chdir File.join File.dirname(__FILE__), '../../'
require './lib/flok'

#Testing the compilation of controller/action user files into javascript counterparts
RSpec.describe "Transition compiler" do
  #Return a v8 instance of a compiled js file
  def compile fn
    compiler = Flok::TransitionCompiler
    js_src(fn)
    js_res = compiler.compile(js_src(fn))
    ctx = V8::Context.new
    ctx.eval js_res
    ctx
  end

  #Get the source for a file in  ./user_compiler/*.rb
  def js_src fn
    Dir.chdir File.join(File.dirname(__FILE__), "transition_compiler") do
      return File.read(fn+'.rb')
    end
  end

  it "Can insert a hook into ${controller_name}_will_goto and this hook is invoked" do

  end

  it "Can load the ruby module" do
    compiler = Flok::TransitionCompiler
  end

  it "Can compile a controller" do
    ctx = compile "trans0"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flok-0.0.105 spec/etc/transition_complier_spec.rb
flok-0.0.103 spec/etc/transition_complier_spec.rb
flok-0.0.102 spec/etc/transition_complier_spec.rb
flok-0.0.101 spec/etc/transition_complier_spec.rb