Skip to content

Commit

Permalink
Update master
Browse files Browse the repository at this point in the history
  • Loading branch information
artemave committed Jun 29, 2012
1 parent 1dc522f commit e733f2a
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions README.markdown
Expand Up @@ -41,39 +41,39 @@ RestAssured::Server.address = 'http://localhost:4578' # or wherever it is


Install db client gem: Install db client gem:


bash$ gem install sqlite3 # or mysql2 or pg $ gem install sqlite3 # or mysql2 or pg


If using mysql/postgres, rest-assured expects database `rest_assured` to be accessible by user `root` with no password. Those are defaults and can be changed with cli options. If using mysql/postgres, rest-assured expects database `rest_assured` to be accessible by user `root` with no password. Those are defaults and can be changed with cli options.


It is also recommended to have thin installed. This improves startup time (over default webrick) and also it works with in-memory sqlite (which webrick does not): It is also recommended to have thin installed. This improves startup time (over default webrick) and also it works with in-memory sqlite (which webrick does not):


bash$ gem install thin $ gem install thin


Then install gem and run: Then install gem and run:


bash$ gem install rest-assured $ gem install rest-assured
bash$ rest-assured & $ rest-assured &


Or clone and run: Or clone and run:


bash$ git clone git://github.com/BBC/REST-assured.git $ git clone git://github.com/BBC/REST-assured.git
bash$ cd REST-assured && bundle install $ cd REST-assured && bundle install
bash$ ./bin/rest-assured -d :memory: & # in-memory sqlite db $ ./bin/rest-assured -d :memory: & # in-memory sqlite db


This starts up an instance of rest-assured on port 4578. It is accessible via REST or web interfaces on `http://localhost:4578` This starts up an instance of rest-assured on port 4578. It is accessible via REST or web interfaces on `http://localhost:4578`


Various options (such as ssl, port, db credentials, etc.) are available through command line options. Check out `rest-assured -h` to see what they are. Various options (such as ssl, port, db credentials, etc.) are available through command line options. Check out `rest-assured -h` to see what they are.


You can also deploy it to heroku: You can also deploy it to heroku:


bash$ git clone git://github.com/BBC/REST-assured.git $ git clone git://github.com/BBC/REST-assured.git
bash$ cd REST-assured $ cd REST-assured


bash$ gem install heroku $ gem install heroku
bash$ heroku login # assuming you already have an account $ heroku login # assuming you already have an account
bash$ heroku create --stack cedar $ heroku create --stack cedar


bash$ git push heroku master $ git push heroku master


## Usage ## Usage


Expand Down Expand Up @@ -136,10 +136,10 @@ For those using REST-assured from non-ruby environments.
Example: Example:


``` ```
bash$ curl -d 'fullpath=/api/something&content=awesome&response_headers%5BContent-Type%5D=text%2Fhtml' http://localhost:4578/doubles $ curl -d 'fullpath=/api/something&content=awesome&response_headers%5BContent-Type%5D=text%2Fhtml' http://localhost:4578/doubles
{"double":{"active":true,"content":"awesome","description":null,"fullpath":"/api/something","id":1,"response_headers":{"Content-Type":"text/html"},"status":200,"verb":"GET"}} {"double":{"active":true,"content":"awesome","description":null,"fullpath":"/api/something","id":1,"response_headers":{"Content-Type":"text/html"},"status":200,"verb":"GET"}}
bash$ curl http://localhost:4578/api/something $ curl http://localhost:4578/api/something
awesome awesome
``` ```


Expand All @@ -151,7 +151,7 @@ For those using REST-assured from non-ruby environments.


Example: Example:


bash$ curl http://localhost:4578/doubles/1.json | prettify_json.rb $ curl http://localhost:4578/doubles/1.json | prettify_json.rb
{ {
"double": { "double": {
"verb": "GET", "verb": "GET",
Expand Down Expand Up @@ -205,8 +205,10 @@ Here is the rest API for managing redirects:
- __to__ - url base e.g, `http://example.com/api/\1?p=1` where `\1` is a reference to captured group from the pattern. Mandatory - __to__ - url base e.g, `http://example.com/api/\1?p=1` where `\1` is a reference to captured group from the pattern. Mandatory


Example: Example:


bash$ curl -d 'pattern=^/auth&to=https://myserver.com/api' http://localhost:4578/redirects ```
$ curl -d 'pattern=^/auth&to=https://myserver.com/api' http://localhost:4578/redirects
```


Now request (any verb) to `http://localhost:4578/auth/services/1` will get redirected to `https://myserver.com/api/`. Provided of course there is no double matched for that fullpath and verb. Captured group in pattern can be referenced from replacement e.g. `\1`, `\2`, etc. Now request (any verb) to `http://localhost:4578/auth/services/1` will get redirected to `https://myserver.com/api/`. Provided of course there is no double matched for that fullpath and verb. Captured group in pattern can be referenced from replacement e.g. `\1`, `\2`, etc.
Much like rewrite rules, redirects are evaluated in order (of creation). In UI you can manually rearrange the order. Much like rewrite rules, redirects are evaluated in order (of creation). In UI you can manually rearrange the order.
Expand All @@ -219,10 +221,10 @@ Here is the rest API for managing redirects:


Tests require there to be mysql database `rest_assured_test` accessible by `root` with no password. Cucumber tests also need firefox. Tests require there to be mysql database `rest_assured_test` accessible by `root` with no password. Cucumber tests also need firefox.


bash$ git clone git://github.com/BBC/REST-assured.git $ git clone git://github.com/BBC/REST-assured.git
bash$ cd rest-assured && bundle install $ cd rest-assured && bundle install
bash$ bundle exec rspec spec $ bundle exec rspec spec
bash$ bundle exec cucumber $ bundle exec cucumber


## Author ## Author


Expand Down

0 comments on commit e733f2a

Please sign in to comment.