Skip to content

Instantly share code, notes, and snippets.

@samueldana
Created January 24, 2013 18:26
Show Gist options
  • Save samueldana/4626086 to your computer and use it in GitHub Desktop.
Save samueldana/4626086 to your computer and use it in GitHub Desktop.
Ramaze before_all hook fails when using a layout?
require 'ramaze'
require 'bacon'
require 'ramaze/spec/bacon'
Ramaze.middleware :spec do
run Ramaze.core
end
Ramaze::Log.level = Logger::ERROR
Ramaze.options.mode = :spec
class SpecHooksWithLayout < Ramaze::Controller
layout :inline_layout
def inline_layout; "USING LAYOUT... #{@content}"; end
before_all { @test = "SUCCESS" }
def index
result = @test
@test = "FAILURE"
result
end
end
describe 'before_all hook' do
behaves_like :rack_test
it 'should execute before_all for an action' do
get('/index').body.should == 'USING LAYOUT... SUCCESS'
get('/index').body.should == 'USING LAYOUT... SUCCESS' # Fails
end
it 'should execute before_all for an action alias' do
get('/').body.should == 'USING LAYOUT... SUCCESS'
get('/').body.should == 'USING LAYOUT... SUCCESS' # Fails
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment