Sha256: d9d19acb46064e0e2921c9de994500ae531b973b8d981405e844eca06a12554e

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 Bytes

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::Controllers::Runtime::Methods do
	
	subject do
		Mojito::C.runtime_controller Mojito::R::Content, Mojito::Controllers::Runtime::Methods do
			on GET() do write 'get' ; halt! end
			on POST() do write 'post' ; halt! end
			on HEAD() do write 'head' ; halt! end
			on PUT() do write 'put' ; halt! end
			on DELETE() do write 'delete' ; halt! end
			on METHOD(:options) do write 'options' ; halt! end
		end.mock_request
	end
	
	it { subject.get('/').body.should == 'get' }
	it { subject.post('/').body.should == 'post' }
	it { subject.head('/').body.should == 'head' }
	it { subject.put('/').body.should == 'put' }
	it { subject.delete('/').body.should == 'delete' }
	it { subject.request('OPTIONS', '/').body.should == 'options' }
	
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mojito-0.2.6 spec/mojito/controllers/runtime/methods_spec.rb
mojito-0.2.5 spec/mojito/controllers/runtime/methods_spec.rb
mojito-0.2.4 spec/mojito/controllers/runtime/methods_spec.rb
mojito-0.2.3 spec/mojito/controllers/runtime/methods_spec.rb