Code Monkey home page Code Monkey logo

rack-test's Introduction

Rack::Test

Description

Rack::Test is a small, simple testing API for Rack apps. It can be used on its own or as a reusable starting point for Web frameworks and testing libraries to build on. Most of its initial functionality is an extraction of Merb 1.0’s request helpers feature.

Features

  • Maintains a cookie jar across requests

  • Easily follow redirects when desired

  • Set request headers to be used by all subsequent requests

  • Small footprint. Approximately 200 LOC

Example

require "rack/test"

class HomepageTest < Test::Unit::TestCase
  include Rack::Test::Methods

  def app
    MyApp.new
  end

  def test_redirect_logged_in_users_to_dashboard
    authorize "bryan", "secret"
    get "/"
    follow_redirect!

    assert_equal "http://example.org/redirected", last_request.url
    assert last_response.ok?
  end

end

Install

To install the latest release as a gem:

sudo gem install rack-test

Authors

  • Maintained by Bryan Helmkamp

  • Contributions from Simon Rozet and Pat Nakajima

  • Much of the original code was extracted from Merb 1.0’s request helper

License

Copyright © 2008-2009 Bryan Helmkamp, Engine Yard Inc. See MIT-LICENSE.txt in this directory.

rack-test's People

Contributors

brynary avatar sr avatar alan avatar josh avatar nakajima avatar ihoka avatar manveru avatar anildigital avatar everythingbehind avatar krekoten avatar louismrose avatar ku1ik avatar smtlaissezfaire avatar ttdonovan avatar tkareine avatar eugenebolshakov avatar

Stargazers

Lin He avatar Administrator avatar  avatar

Watchers

James Cloos avatar

Forkers

reservationlive

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.