Sha256: e96c42742dfa64e4a487f3e1d45f3e2d9114f4286c53bfb609e9f857c53ea539

Contents?: true

Size: 855 Bytes

Versions: 4

Compression:

Stored size: 855 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::UrlScheme do
	
	subject do
		Mojito::C.runtime_controller Mojito::Controllers::Runtime::UrlScheme, Mojito::R::Content do
			on SCHEME(:http) do write 'insecure' ; halt! end
			on SCHEME(:https) do write 'secure' ; halt! end
		end.mock_request
	end
	
	it { subject.get('http://localhost/').should respond_with(200, 'insecure') }
	it { subject.get('http://localhost:7777/').should respond_with(200, 'insecure') }
	it { subject.get('https://localhost:80/').should respond_with(200, 'secure') }
	it { subject.get('https://localhost/').should respond_with(200, 'secure') }
	it { subject.get('otherprotocol://test/').should respond_with(404) }
	
end

Version data entries

4 entries across 4 versions & 1 rubygems

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