spec/kern/controller_spec.rb in flok-0.0.31 vs spec/kern/controller_spec.rb in flok-0.0.32
- old
+ new
@@ -23,11 +23,11 @@
int_dispatch([]);
}
base = ctx.eval("base")
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, 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"}])
end
@@ -46,11 +46,11 @@
int_dispatch([]);
}
base = ctx.eval("base")
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {"secret" => secret}])
@driver.mexpect("if_attach_view", [base+1, 0])
@driver.mexpect("if_event", [base, "action", {"from" => nil, "to" => "my_action"}])
end
@@ -69,16 +69,16 @@
int_dispatch([]);
}
base = ctx.eval("base")
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {"secret" => secret}])
@driver.mexpect("if_attach_view", [base+1, 0])
- @driver.mexpect("if_init_view", ["test_view2", {}, base+5, ["main", "hello", "world"]])
#We expect the sub controller to receive the same info
+ @driver.mexpect("if_init_view", ["my_sub_controller", {}, base+5, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base+4, base+5, "my_sub_controller", {"secret" => secret}])
end
it "Can initiate a controller via _embed and have a controller_info located in tel table" do
#Compile the controller
@@ -161,18 +161,18 @@
}
base = ctx.eval('base')
#First, we expect the base vc to be setup as a view
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
@driver.mexpect("if_attach_view", [base+1, 0])
#Now we expect the embedded view to be setup as a view within the base view
#It's +5, because the base takes us 4 (+3) entries, and then the next embedded takes up
#the next view controlelr and finally main view entry (5th)
- @driver.mexpect("if_init_view", ["test_view2", {}, base+5, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_sub_controller", {}, base+5, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base+4, base+5, "my_sub_controller", {}])
@driver.mexpect("if_attach_view", [base+5, base+2])
#Now expect actions in reverse order up hierarchy
@driver.mexpect("if_event", [base+4, "action", {"from" => nil, "to" => "my_action"}])
@@ -237,11 +237,11 @@
#Now we expect some variables to be set in the action
expect(ctx.eval("test_action_called_base")).not_to eq(nil)
expect(ctx.eval("test_action_called_params")).not_to eq(nil)
end
- it "Can initiate a controller via _embed and have a tracked list of embeds in info" do
+ it "Can initiate a controller via _embed and have a tracked list of embeds in info" do
#Compile the controller
ctx = flok_new_user File.read('./spec/kern/assets/controller1.rb')
#Run the embed function
ctx.eval %{
@@ -303,16 +303,16 @@
#Expect that a view was embedded inside a view at this point
#The view (or main spot/view) should be base+1 because base+0 is the vc itself.
#['vc', 'main', 'hello', 'world'], ['vc', 'main']
#|--0-----1--------2--------3---|=======================The my_controller
# |-4------5---|====== The my_controller2
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "hello", "world"]])
@driver.mexpect("if_controller_init", [base, base+1, "my_controller", {}])
@driver.mexpect("if_attach_view", [base+1, 0]) #Attach to main root spot
#Embed my_controller2 in action 'my_action'
- @driver.mexpect("if_init_view", ["test_view2", {}, base+5, ["main"]])
+ @driver.mexpect("if_init_view", ["my_controller2", {}, base+5, ["main"]])
@driver.mexpect("if_controller_init", [base+4, base+5, "my_controller2", {}])
@driver.mexpect("if_attach_view", [base+5, base+2])
#Expect action start
@driver.mexpect("if_event", [base+4, "action", {"from" => nil, "to" => "my_action"}])
@@ -375,11 +375,11 @@
}
base = ctx.eval("base")
#The usual
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main"]])
@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"}])
@driver.mexpect("if_event", [base, "action", {"from" => "my_action", "to" => "my_other_action"}])
end
@@ -401,11 +401,11 @@
int_dispatch([3, "int_event", base, "test_event", {}]);
}
base = ctx.eval("base")
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "content"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, base+1, ["main", "content"]])
@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"}])
@driver.mexpect("if_event", [base, "action", {"from" => "my_action", "to" => "my_other_action"}])
end
@@ -426,10 +426,10 @@
int_dispatch([3, "int_event", base, "hello", {secret: "#{secret}"}]);
}
base = ctx.eval("base")
- @driver.mexpect("if_init_view", ["test_view", {}, base+1, ["main", "hello", "world"]])
+ @driver.mexpect("if_init_view", ["my_controller", {}, 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"}])
@driver.mexpect("if_event", [base, "test_event", {"secret" => secret}])
end