Sha256: 031f5ad4774bce304999eee5e06b38c48c514340f4e8e1e010eb9f32431fb456

Contents?: true

Size: 1.41 KB

Versions: 11

Compression:

Stored size: 1.41 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 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

class SpecControllerInheritedYetAnother < SpecControllerInheritedAnother
  Ramaze.node('/yet_another').engine(:Maruku)
  def index; "Yet Another is Maruku. Inherited but overriden"; 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

  should "be able to override inherited provide" do
    get('/yet_another').body.should ==
      "<p>Yet Another is Maruku. Inherited but overriden</p>"
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

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