Sha256: ca823728b6d0cab2d6a913ad970e0d77d3e85566703cfaf6c3dceb12710d89fb

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

# encoding: UTF-8
require 'simplecov' and SimpleCov.start do
	add_filter "spec/"
	add_filter "lib/mojito/utils/rspec.rb"
end
require 'mojito'
require 'mojito/utils/rspec'

describe Mojito::Rendering::Delegation do
	
	subject do
		sub_app = Mojito::C.runtime_controller Mojito::H::Shortcuts, Mojito::R::Content do
			on PATH('this/is/the/sub-application') do write request.context_path ; halt! end
			on true do write 'sub-application' ; halt! end
		end
		Mojito::C.runtime_controller Mojito::R::Content, Mojito::R::Delegation do
			on 'to/sub/app' do run! sub_app end
		end.mock_request
	end
	
	it { subject.get('/to/sub/app').should respond_with(200, 'sub-application') }
	it { subject.get('/to/sub/app/this/is/the/sub-application').should respond_with(200, '/to/sub/app') }
	
	context do
		
		subject do
			sub_app = Mojito::C.runtime_controller Mojito::R::Content, Mojito::H::Shortcuts do
				on true do write("#{path_info} #{captures.first}") ; halt! end
			end
			Mojito::C.runtime_controller Mojito::R::Content, Mojito::R::Delegation do
				on PATH('hello/:name') do run! sub_app end
			end.mock_request
		end
		
		it { subject.get('/hello/world/rest').should respond_with(200, '/rest world') }

	end
		
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mojito-0.2.6 spec/mojito/rendering/delegation_spec.rb
mojito-0.2.5 spec/mojito/rendering/delegation_spec.rb
mojito-0.2.4 spec/mojito/rendering/delegation_spec.rb
mojito-0.2.3 spec/mojito/rendering/delegation_spec.rb