Sha256: d72c1f0f462fc23a28e6f383975a132909e65fcf95b6aa60c43b1db470026604

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

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

describe Mojito::Matchers::UrlScheme do
	
	subject do
		Mojito.application Mojito::Matchers::UrlScheme 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/').body.should == 'insecure' }
	it { subject.get('http://localhost:7777/').body.should == 'insecure' }
	it { subject.get('https://localhost:80/').body.should == 'secure' }
	it { subject.get('https://localhost/').body.should == 'secure' }
	it { subject.get('otherprotocol://test/').status.should == 404 }
	
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mojito-0.1.2 spec/mojito/matchers/url_scheme_spec.rb
mojito-0.1.1 spec/mojito/matchers/url_scheme_spec.rb