Sha256: 946afce37d1fc430a02fc077e2ca6f9341017b0a251a44dde835cefe05e240d2

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

#          Copyright (c) 2006 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
  template :foo, :bar
  template :one, self, :another

  def test() 'test' end
end

class MainController < BaseController
  engine :None
end

describe 'Controller' do
  behaves_like 'http'
  ramaze

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

  it 'should respect template mappings set in 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 'should respect template mappings set in 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

15 entries across 15 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.09 spec/ramaze/controller/subclass.rb
Pistos-ramaze-2008.12 spec/ramaze/controller/subclass.rb
Pistos-ramaze-2009.01 spec/ramaze/controller/subclass.rb
Pistos-ramaze-2009.02 spec/ramaze/controller/subclass.rb
manveru-ramaze-2008.08 spec/ramaze/controller/subclass.rb
manveru-ramaze-2008.09 spec/ramaze/controller/subclass.rb
manveru-ramaze-2008.10 spec/ramaze/controller/subclass.rb
manveru-ramaze-2008.12 spec/ramaze/controller/subclass.rb
manveru-ramaze-2009.01 spec/ramaze/controller/subclass.rb
ptomato-ramaze-2009.02.1 spec/ramaze/controller/subclass.rb
ptomato-ramaze-2009.02 spec/ramaze/controller/subclass.rb
ramaze-2008.11 spec/ramaze/controller/subclass.rb
ramaze-2009.01 spec/ramaze/controller/subclass.rb
ramaze-2009.02 spec/ramaze/controller/subclass.rb
ramaze-2009.03 spec/ramaze/controller/subclass.rb