Sha256: a3ba457ad36c2186757896b3feadfe4952a8f4f28f0e279fd7343300169c6528

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

require 'spec/helper'

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

  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

10 entries across 10 versions & 3 rubygems

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