Sha256: 2eadbe92c51bd3e0a5d9c756a91c3b763214c2f3f754a373e6b36adf7b2fad7a

Contents?: true

Size: 1.28 KB

Versions: 16

Compression:

Stored size: 1.28 KB

Contents

Dir.chdir File.join File.dirname(__FILE__), '../../'
require './spec/env/kern.rb'
require './spec/lib/helpers.rb'
require './spec/lib/io_extensions.rb'
require './spec/lib/rspec_extensions.rb'

RSpec.describe "kern:timer_service_spec" do
  include_context "kern"

  #Can initialize a controller via embed and have the correct if_dispatch messages
  it "Can initiate a controller via _embed" do
    #Compile the controller
    ctx = flok_new_user File.read('./spec/kern/assets/timer_service.rb')

    #Run the embed function
    ctx.eval %{
      //Call embed on main root view
      base = _embed("my_controller", 0, {}, null);

      //Drain queue with a test event
      int_dispatch([3, "int_event", base, "start_request", {}]);
    }

    base = ctx.eval("base")

    @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
    @driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
    @driver.mexpect("if_attach_view", [base+1, 0])
    @driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "my_action"}])

    #Emulate the if_timer driver
    @driver.int("int_timer")
    @driver.int("int_timer")
    @driver.int("int_timer")
    @driver.int("int_timer")

    response = ctx.eval("did_tick")
    expect(response).to eq(true)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
flok-0.0.31 spec/kern/timer_service_spec.rb
flok-0.0.30 spec/kern/timer_service_spec.rb
flok-0.0.29 spec/kern/timer_service_spec.rb
flok-0.0.28 spec/kern/timer_service_spec.rb
flok-0.0.27 spec/kern/timer_service_spec.rb
flok-0.0.26 spec/kern/timer_service_spec.rb
flok-0.0.25 spec/kern/timer_service_spec.rb
flok-0.0.24 spec/kern/timer_service_spec.rb
flok-0.0.23 spec/kern/timer_service_spec.rb
flok-0.0.21 spec/kern/timer_service_spec.rb
flok-0.0.20 spec/kern/timer_service_spec.rb
flok-0.0.19 spec/kern/timer_service_spec.rb
flok-0.0.18 spec/kern/timer_service_spec.rb
flok-0.0.17 spec/kern/timer_service_spec.rb
flok-0.0.16 spec/kern/timer_service_spec.rb
flok-0.0.14 spec/kern/timer_service_spec.rb