Sha256: 6945f9ecea2c502549065e658b4752ecde4792547979fe25fbe8c6300d916761

Contents?: true

Size: 1.06 KB

Versions: 5

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 MIT license.

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

class SpecControllerInheritedMain < Ramaze::Controller
  Ramaze.node('/')

  def index
    @ngr = "Main is nagoro"
    "<p>#{@ngr}</p>"
  end
end

class SpecControllerInheritedOther < Ramaze::Controller
  Ramaze.node('/other').engine(:Haml)
  def index; "%p Other is haml"; end
end

class SpecControllerInheritedAnother < SpecControllerInheritedOther
  Ramaze.node('/another')
  def index; "%p Another is haml. Inherit from Other"; end
end

describe 'Ramaze::Controller#self.inherited' do
  behaves_like :rack_test

  should 'default renders nagoro' do
    get('/').body.should == "<p>Main is nagoro</p>"
  end

  should 'be able to render provided format' do
    get('/other').body.should == "<p>Other is haml</p>\n"
  end

  should "inherit provide from parent controller" do
    get('/another').body.should ==
      "<p>Another is haml. Inherit from Other</p>\n"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/controller/provide_inheritance.rb
ramaze-2012.12.08 spec/ramaze/controller/provide_inheritance.rb
ramaze-2012.12.08b spec/ramaze/controller/provide_inheritance.rb
ramaze-2012.04.14 spec/ramaze/controller/provide_inheritance.rb
ramaze-2012.03.07 spec/ramaze/controller/provide_inheritance.rb