Sha256: ea656790c7e966ccb23a645c09f582a2623b6db64d80ab55fb601632fe04da78

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 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 'spec/helper'

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 :mock

  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

10 entries across 10 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.04.08 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.04.01 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.04.08 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.04.18 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.04.22 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.04 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.05.08 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.05 spec/ramaze/controller/subclass.rb
ramaze-2009.04 spec/ramaze/controller/subclass.rb
ramaze-2009.05 spec/ramaze/controller/subclass.rb