rest-assured 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.markdown +17 -11
- data/db/test.db +0 -0
- data/features/rest_api/doubles.feature +1 -0
- data/features/support/env.rb +4 -4
- data/lib/rest-assured/application.rb +1 -1
- data/lib/rest-assured/config.rb +1 -2
- data/lib/rest-assured/models/double.rb +1 -0
- data/lib/rest-assured/models/redirect.rb +2 -0
- data/lib/rest-assured/models/request.rb +2 -0
- data/lib/rest-assured/version.rb +1 -1
- data/spec/functional/response_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +3 -4
- data/db/development.db +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c35115ced77a2089492a155ef70c877a7f79155
|
4
|
+
data.tar.gz: 3d0869cf86b0874e797e40054776213c87d7c145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db3e43f69330695ba514f99c3851e78020828700aab04104e000149799941ac7d83b74ac147712a6355269c807ab5afa585f5acffae7215c9994289853fb7556
|
7
|
+
data.tar.gz: 0c9b77fe69ea6dbf572130f7e998557ef0a89ed2c76b1bcad92bb5f8b2fa1f08a402726185bafa82bcb5a90f83cb44ac956f4d5f77a742787c210dbfed721d3b
|
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
@@ -3,44 +3,50 @@
|
|
3
3
|
[![Build status](https://secure.travis-ci.org/artemave/REST-assured.png)](https://travis-ci.org/artemave/REST-assured)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/rest-assured.png)](http://badge.fury.io/rb/rest-assured)
|
5
5
|
|
6
|
+
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
|
7
|
+
|
6
8
|
## Overview
|
7
9
|
|
8
10
|
Stub/spy http(s) based external dependencies in your integration/acceptance tests.
|
9
11
|
|
10
12
|
## Description
|
11
13
|
|
12
|
-
|
14
|
+
With REST-assured you can:
|
15
|
+
|
16
|
+
* in tests: replace external HTTP(S) based data sources with predefined data (stubbing)
|
17
|
+
* in tests: verify requests to external services (spying)
|
18
|
+
* in development: simulate different behavior of external services using web UI; it looks like this:
|
13
19
|
|
14
|
-
|
15
|
-
* verify requests to external services (spying)
|
16
|
-
* simulate different behavior of external services using web UI; useful in development
|
20
|
+
![web ui screenshot](https://dl.dropboxusercontent.com/s/cb801va6t3zejdv/fakeshit.png?dl=0)
|
17
21
|
|
18
|
-
REST-assured
|
22
|
+
REST-assured is a web server that can be started programmatically and configured at runtime (via ruby client library or REST api) to respond to any request with arbitrary content, status, headers, etc.
|
19
23
|
|
20
|
-
|
24
|
+
But why not to use [VCR](https://github.com/vcr/vcr) or [WebMock](https://github.com/bblimke/webmock) instead? Well, you certainly should. If you can. REST-assured was born on a project where code was written in Java and integration tests in Ruby. This may sound a bit crazy, but the world is full crazy things and if you find yourself in one, you might find REST-assured useful.
|
21
25
|
|
22
26
|
[Playground](http://fakesh.it/)
|
23
27
|
|
24
28
|
[Example project](https://github.com/artemave/REST-assured-example)
|
25
29
|
|
30
|
+
[Long-winded intro blog post](http://artemave.github.com/2012/05/27/stub-like-a-surgeon-spy-like-james-bond-with-rest-assured/)
|
31
|
+
|
26
32
|
|
27
33
|
## Set up
|
28
34
|
|
29
|
-
You are going to need ruby >= 1.9.
|
35
|
+
You are going to need ruby >= 1.9.3 and either sqlite3, postgres or mysql.
|
30
36
|
|
31
37
|
### In ruby project
|
32
38
|
|
33
39
|
```ruby
|
34
40
|
# Gemfile
|
35
41
|
gem 'sqlite3' # or mysql2 or pg
|
36
|
-
# use 'jdbcsqlite3'
|
42
|
+
# use 'jdbcsqlite3' or 'jdbcmysql' for jruby
|
37
43
|
gem 'rest-assured'
|
38
44
|
|
39
45
|
# env.rb/spec_helper.rb
|
40
46
|
require 'rest-assured'
|
41
47
|
|
42
|
-
RestAssured::Server.start(database: ':memory:'
|
43
|
-
# Or
|
48
|
+
RestAssured::Server.start(database: ':memory:') # or any other option available on command line
|
49
|
+
# Or you can specify an instance that is already running somewhere:
|
44
50
|
RestAssured::Server.address = 'http://wacky-duckling.herokuapp.com'
|
45
51
|
```
|
46
52
|
|
@@ -213,7 +219,7 @@ Here is the rest API for managing redirects:
|
|
213
219
|
|
214
220
|
## Running tests
|
215
221
|
|
216
|
-
Tests require
|
222
|
+
Tests require sqlite. Cucumber tests also need Chrome.
|
217
223
|
|
218
224
|
$ git clone git://github.com/artemave/REST-assured.git
|
219
225
|
$ cd rest-assured && bundle install
|
data/db/test.db
CHANGED
Binary file
|
@@ -34,6 +34,7 @@ Feature: use doubles via api
|
|
34
34
|
| /api/asdfsf | removed | DELETE | 202 |
|
35
35
|
| /api/some?a=3&b=dd | more content | GET | 203 |
|
36
36
|
| /other/api | | GET | 303 |
|
37
|
+
| /patch/api | | PATCH | 200 |
|
37
38
|
|
38
39
|
# current rule: last added double gets picked
|
39
40
|
Scenario Outline: request fullpath that matches multiple doubles
|
data/features/support/env.rb
CHANGED
@@ -26,14 +26,14 @@ module RackHeaderHack
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
Capybara.register_driver :selenium do |app|
|
30
|
+
Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
31
|
+
end
|
32
32
|
|
33
33
|
World(Capybara, Rack::Test::Methods, RackHeaderHack, WorldHelpers, Anticipate)
|
34
34
|
|
35
35
|
require 'rest-assured/config'
|
36
|
-
db_opts = { :adapter => '
|
36
|
+
db_opts = { :adapter => 'sqlite' }
|
37
37
|
RestAssured::Config.build(db_opts)
|
38
38
|
|
39
39
|
require 'rest-assured'
|
data/lib/rest-assured/config.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'logger'
|
2
|
-
require 'active_record'
|
3
|
-
require 'active_support/core_ext/kernel/reporting'
|
4
2
|
|
5
3
|
module RestAssured
|
6
4
|
module Config
|
@@ -67,6 +65,7 @@ module RestAssured
|
|
67
65
|
private
|
68
66
|
|
69
67
|
def self.setup_db
|
68
|
+
require 'active_record'
|
70
69
|
setup_db_logging
|
71
70
|
connect_db
|
72
71
|
migrate_db
|
data/lib/rest-assured/version.rb
CHANGED
@@ -3,8 +3,8 @@ require 'rest-assured/routes/response'
|
|
3
3
|
|
4
4
|
module RestAssured
|
5
5
|
describe Response do
|
6
|
-
[:get, :post, :put, :delete].each do |verb|
|
7
|
-
it "processes
|
6
|
+
[:get, :post, :put, :delete, :patch].each do |verb|
|
7
|
+
it "processes a #{verb.to_s.upcase} request" do
|
8
8
|
|
9
9
|
expect(Response).to receive(:perform).with(an_instance_of(RestAssured::Application))
|
10
10
|
send verb, '/some/path'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-assured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Avetisyan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- LICENSE
|
121
121
|
- README.markdown
|
122
122
|
- bin/rest-assured
|
123
|
-
- db/development.db
|
124
123
|
- db/migrate/20110620161740_add_fixtures.rb
|
125
124
|
- db/migrate/20110625155332_add_redirects_table.rb
|
126
125
|
- db/migrate/20110709150645_add_description_to_fixtures.rb
|
@@ -230,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
229
|
version: '0'
|
231
230
|
requirements: []
|
232
231
|
rubyforge_project: rest-assured
|
233
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.5.1
|
234
233
|
signing_key:
|
235
234
|
specification_version: 4
|
236
235
|
summary: Real stubs and spies for HTTP(S) services
|
data/db/development.db
DELETED
Binary file
|