Sha256: 38d338f470081bd7c6ef7ad5ded702ef27711dbc652cec2a3af7a9b57e592fae
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' require 'rack/test' require 'tdiary/application' describe TDiary::Application do include Rack::Test::Methods before do end describe '#call' do let(:app) { TDiary::Application.new } context "when is accessed to index" it do get '/' expect(last_response.status).to eq 200 end context "when is accessed to update" do it do get '/update.rb' expect(last_response.status).to eq 401 end end context "with base_dir" do let(:app) { TDiary::Application.new('/diary') } it do get '/diary/' expect(last_response.status).to eq 200 end context "when access to root directory" do it do get '/' expect(last_response.status).to eq 404 end end end context "when the application raises exception" do before do allow(TDiary::Dispatcher).to receive_message_chain(:index).and_return( lambda {|env| raise StandardError.new } ) end it do get '/' expect(last_response.status).to eq 500 expect(last_response.body).to match(/^StandardError/) end end end end # Local Variables: # mode: ruby # indent-tabs-mode: t # tab-width: 3 # ruby-indent-level: 3 # End:
Version data entries
4 entries across 4 versions & 1 rubygems