Sha256: 051156d6f90d3830c9fa960c7b31d4881b4453a62887251f1863e694e385ab55

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

module Happy
  describe Controller::Cascadable do

    describe '#method_missing' do
      it "passes on all method calls to a parent if there is one" do
        class Inner < Controller
          def route
            path 'one' do
              some_helper
            end

            path 'two' do
              some_unknown_helper
            end
          end
        end

        class Middle < Controller
          def route
            run Inner
          end
        end

        class Outer < Controller
          def some_helper; 'some_information'; end
          def route
            run Middle
          end
        end

        def app
          Outer
        end

        response_for { get '/one' }.body.should == 'some_information'
        response_for { get '/two' }.status.should == 500
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
happy-0.1.0.pre21 spec/controller/cascadable_spec.rb
happy-0.1.0.pre20 spec/controller/cascadable_spec.rb