Sha256: db9cf0d05ba47f6cb3331014e94b0d937d18e964746ab179bed9b7ef9c45edc7

Contents?: true

Size: 1.57 KB

Versions: 18

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'
require 'rack/test'
require 'tdiary/rack/valid_request_path'

describe TDiary::Rack::ValidRequestPath do
	include Rack::Test::Methods

	describe "valid request" do
		let(:app) { TDiary::Rack::ValidRequestPath.new(
			lambda{|env| [200, {}, ['Awesome']]} )}

		it 'should return 200 for latest' do
			get '/'
			last_response.should be_ok
		end

		it 'should return 200 for a nyear' do
			get '/0501.html'
			last_response.should be_ok
		end

		it 'should return 200 for a month' do
			get '/201205.html'
			last_response.should be_ok
		end

		it 'should return 200 for a day' do
			get '/20120501.html'
			last_response.should be_ok
		end

		it 'should return 200 for a day with section_permalink_anchor plugin' do
			get '/20120501p01.html'
			last_response.should be_ok
		end

		it 'should return 200 for a day with query' do
			get '/?date=20120501'
			last_response.should be_ok
		end

		it 'should return 200 for a day with query and section_permalink_anchor plugin' do
			get '/?date=20120501&p=01'
			last_response.should be_ok
		end

		it 'should return 200 for a day with index.rb and query' do
			get '/index.rb?date=20120501'
			last_response.should be_ok
		end

		it 'should return 404 for access to the invalid file' do
			get '/20120501'
			last_response.status.should be 404
			get '/invalid'
			last_response.status.should be 404
			head '/invalid'
			last_response.status.should be 404
			last_response.body.length.should be 0
		end

		it 'should return 404 for access to the invalid directory' do
			get '/invalid/'
			last_response.status.should == 404
		end
	end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tdiary-4.0.2.20140201 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.2 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.1.20131102 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.1.20130929 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.1.20130903 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.1 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.0.20130826 spec/core/rack/valid_request_path_spec.rb
tdiary-4.0.0 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130727 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130722 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130720 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130617 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130614 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130604 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130527 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130518 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130508 spec/core/rack/valid_request_path_spec.rb
tdiary-3.2.2.20130507 spec/core/rack/valid_request_path_spec.rb