Skip to content

Commit 55ee961

Browse files
committed
Added missing specs for Ronin::Web::Server::Helpers.
1 parent 855eeb0 commit 55ee961

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎spec/helpers_spec.rb‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'spec_helper'
2+
require 'ronin/web/server/helpers'
3+
4+
require 'sinatra/base'
5+
6+
describe Ronin::Web::Server::Helpers do
7+
module TestHelpersMixin
8+
class TestApp < Sinatra::Base
9+
include Ronin::Web::Server::Helpers
10+
end
11+
end
12+
13+
subject { TestHelpersMixin::TestApp.new.helpers }
14+
15+
describe "#mime_type_for" do
16+
it "must return the MIME Type for the given path's file extension" do
17+
expect(subject.mime_type_for('file.xml')).to eq('application/xml')
18+
end
19+
end
20+
21+
describe "#content_type_for" do
22+
before do
23+
subject.response = Sinatra::Response.new
24+
end
25+
26+
it "must return the Content-Type for the given path's file extension" do
27+
subject.content_type_for('file.xml')
28+
29+
expect(subject.response['Content-Type']).to eq('application/xml;charset=utf-8')
30+
end
31+
end
32+
end

0 commit comments

Comments
 (0)