Skip to content

rafaelss/fakepage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FakePage

FakePage is a simple class that use rack and thin to create an environment where you can make tests simulating real web requests.

Example

page = FakePage.new('home', :body => 'this is my home page')
# Net::HTTP
puts Net::HTTP.get(page.url)
# Curb
puts Curl::Easy.perform(page.url).body_str

Also, you can specify the HTTP method

FakePage.new('another_page', :method => :get, :body => 'another body page')

Or

FakePage.get('do_get', :body => 'another body page')
FakePage.post('do_post', :body => 'another body page')
FakePage.put('do_put', :body => 'another body page')
FakePage.delete('do_delete', :body => 'another body page')

Others options are: code and content_type

Source Code

The source code is hosted on github

http://github.com/rafaelss/fakepage

LICENSE:

(The MIT License)

Copyright © 2009 Rafael Souza <me@rafaelss.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Agnostic library for test web requests creating fake pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages