Initial Commit
Base Script with a Rake Verification
This commit is contained in:
commit
41e6fd2cdc
11 changed files with 171 additions and 0 deletions
6
spec/example_requests/get-examples.request.txt
Normal file
6
spec/example_requests/get-examples.request.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
GET /examples HTTP/1.1
|
||||
Host: example.com
|
||||
User-Agent: ExampleBrowser/1.0
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
|
||||
6
spec/example_requests/get-fruits-with-filter.request.txt
Normal file
6
spec/example_requests/get-fruits-with-filter.request.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
GET /fruits?type=bananas&minrating=4 HTTP/1.1
|
||||
Host: fruits.com
|
||||
User-Agent: ExampleBrowser/1.0
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
|
||||
4
spec/example_requests/get-index.request.txt
Normal file
4
spec/example_requests/get-index.request.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
GET / HTTP/1.1
|
||||
Host: developer.mozilla.org
|
||||
Accept-Language: fr
|
||||
|
||||
6
spec/example_requests/post-login.request.txt
Normal file
6
spec/example_requests/post-login.request.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
POST /login HTTP/1.1
|
||||
Host: foo.example
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Content-Length: 39
|
||||
|
||||
username=grillkorv&password=verys3cret!
|
||||
25
spec/http_parser_spec.rb
Normal file
25
spec/http_parser_spec.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
require_relative 'spec_helper'
|
||||
require_relative '../lib/Request'
|
||||
|
||||
describe 'Request' do
|
||||
|
||||
describe 'Simple get-request' do
|
||||
|
||||
it 'parses the http verb' do
|
||||
@request = Request.new(File.read('./spec/example_requests/get-index.request.txt'))
|
||||
_(@request.method).must_equal "GET"
|
||||
end
|
||||
|
||||
it 'parses the resource' do
|
||||
@request = Request.new(File.read('./spec/example_requests/get-index.request.txt'))
|
||||
_(@request.resource).must_equal "/"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
describe 'get-requests with url params' do
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
1
spec/spec_helper.rb
Normal file
1
spec/spec_helper.rb
Normal file
|
|
@ -0,0 +1 @@
|
|||
require 'minitest/autorun'
|
||||
Loading…
Add table
Add a link
Reference in a new issue