require File.dirname(__FILE__) + '/spec_helper.rb' require "rack" require_fixtures 'application_spec_applications' describe Trellis::Page, " when sending an event to a page" do before(:each) do @application = TestApp::MyApp.new @request = Rack::MockRequest.new(@application) end it "if the event handler returns self it should render the receiving page" do response = @request.get("/home.event1") response.body.should == "
Goodbye Cruel World
" end it "should invoke the before_load method if provided by the page" do response = @request.get("/before_load") response.body.should == "8675309" end it "should invoke the after_load method if provided by the page" do response = @request.get("/after_load") response.body.should == "chunky bacon!" end end describe Trellis::Page, " when calling inject_dependent_pages on an instance of child class of Page" do it "should contain instances of the injected pages" do homepage = TestApp::Home.new homepage.inject_dependent_pages injected_page = homepage.instance_eval { @other } injected_page.should be_an_instance_of(TestApp::Other) end end