Sha256: 68dd3cad3be4f048b839978ac0f9911c296440d45e09691544f3b2d3cf151295
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' require 'ronin/web/server/base' require 'classes/test_app' require 'helpers/rack_app' describe Ronin::Web::Server::Base do include Helpers::Web::RackApp before(:all) do self.app = TestApp end it "should still bind blocks to paths" do get '/tests/get' expect(last_response).to be_ok expect(last_response.body).to eq('block tested') end it "should bind a block to a path for all request types" do post '/tests/any' expect(last_response).to be_ok expect(last_response.body).to eq('any tested') end it "should have a default response" do get '/totally/non/existant/path' expect(last_response).not_to be_ok expect(last_response.body).to be_empty end it "should allow for defining custom responses" do TestApp.default do halt 404, 'nothing to see here' end get '/whats/here' expect(last_response).not_to be_ok expect(last_response.body).to eq('nothing to see here') end it "should map paths to sub-apps" do get '/tests/subapp/' expect(last_response).to be_ok expect(last_response.body).to eq('SubApp') end it "should not modify the path_info as it maps paths to sub-apps" do get '/tests/subapp/hello' expect(last_response).to be_ok expect(last_response.body).to eq('SubApp greets you') end it "should host static content from public directories" do get '/static1.txt' expect(last_response).to be_ok expect(last_response.body).to eq("Static file1.\n") end it "should host static content from multiple public directories" do get '/static2.txt' expect(last_response).to be_ok expect(last_response.body).to eq("Static file2.\n") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ronin-web-server-0.1.0.beta1 | spec/base_spec.rb |