Sha256: 336f60225dc3d0e6c50e40a2f24241554cc46dbce6b7194f4016f1ee34f68b6f

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require File.expand_path('../../../../spec/helper', __FILE__)

class BaseController < Ramaze::Controller
  alias_view :foo, :bar
  alias_view :one, :another, self

  def test() 'test' end
end

class MainController < BaseController
end

describe 'Controller' do
  behaves_like :rack_test

  it 'allows sub-classing MainController' do
    get('/test').body.should == 'test'
  end

  it 'respects view aliase from superclass, with no explicit controller' do
    # The template file it should use is view/bar.xhtml, as the template
    # mapping doesn't specify a controller, so it will be implicitly relative
    # to MainController.
    get('/foo').body.should == 'bar'
  end

  it 'respects view aliase from superclass, with an explicit controller' do
    # Note that the template file it should use is view/base/another.xhtml,
    # because BaseController explicitly specifies the template mapping in
    # relation to self.
    get('/one').body.should == 'another'
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.07 spec/ramaze/controller/subclass.rb
ramaze-2011.12.28 spec/ramaze/controller/subclass.rb
ramaze-2011.10.23 spec/ramaze/controller/subclass.rb
ramaze-2011.07.25 spec/ramaze/controller/subclass.rb
ramaze-2011.01.30 spec/ramaze/controller/subclass.rb
ramaze-2011.01 spec/ramaze/controller/subclass.rb
ramaze-2010.06.18 spec/ramaze/controller/subclass.rb
ramaze-2010.04.04 spec/ramaze/controller/subclass.rb
ramaze-2010.04 spec/ramaze/controller/subclass.rb
ramaze-2010.03 spec/ramaze/controller/subclass.rb
ramaze-2010.01 spec/ramaze/controller/subclass.rb
ramaze-2009.10 spec/ramaze/controller/subclass.rb
ramaze-2009.07 spec/ramaze/controller/subclass.rb