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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 320425382c9e1d8d34f2a6d6daa53bf7e6af42f6
4
- data.tar.gz: 5e9c14601074ee5b5ee589617b9d2e0be387fe9a
3
+ metadata.gz: 5c35115ced77a2089492a155ef70c877a7f79155
4
+ data.tar.gz: 3d0869cf86b0874e797e40054776213c87d7c145
5
5
  SHA512:
6
- metadata.gz: 805ce441b6dc113fe988e691533ecce3609798163e60875eeeb1c1640ecc0bc60ead758129a7dcec17012a3b3caab7623bf01d6af8a1893a88ca664fa74c5eaf
7
- data.tar.gz: 1640ad76091994a6ff2794f5df9394a88158aaad556551da207ae2085b04bbd9d11ab8d44ea820707ae6c977f957d526b5f59df456138c5e2a960d1ff127de81
6
+ metadata.gz: db3e43f69330695ba514f99c3851e78020828700aab04104e000149799941ac7d83b74ac147712a6355269c807ab5afa585f5acffae7215c9994289853fb7556
7
+ data.tar.gz: 0c9b77fe69ea6dbf572130f7e998557ef0a89ed2c76b1bcad92bb5f8b2fa1f08a402726185bafa82bcb5a90f83cb44ac956f4d5f77a742787c210dbfed721d3b
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2.0.2 (24 May 2016)
2
+
3
+ - fix PATCH doubles always 404
4
+
1
5
  2.0.1 (9 May 2015)
2
6
 
3
7
  - update dependencies
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
- In a nutshell, you can:
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
- * replace external data sources with predefined data (stubbing)
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 runs in a standalone process. It can be configured at runtime (via ruby client library or REST api) to respond to any request with arbitrary content, status, headers, etc.
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
- The idea is that in "test" environment your app is making calls to REST-assured rather than to real external services.
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.2 on Linux/MacOS. Also, one of sqlite3, postgres or mysql.
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' and 'jdbcmysql' for jruby
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:', port: 7899) # or any other option available on command line
43
- # Or, you can specify an instance that is already running somewhere:
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 there to be mysql database `rest_assured_test` accessible by `root` with no password. Cucumber tests also need firefox.
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
@@ -26,14 +26,14 @@ module RackHeaderHack
26
26
  end
27
27
  end
28
28
 
29
- # Capybara.register_driver :selenium do |app|
30
- # Capybara::Selenium::Driver.new(app, :browser => :chrome)
31
- # end
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 => 'postgresql' }
36
+ db_opts = { :adapter => 'sqlite' }
37
37
  RestAssured::Config.build(db_opts)
38
38
 
39
39
  require 'rest-assured'
@@ -35,7 +35,7 @@ module RestAssured
35
35
  include DoubleRoutes
36
36
  include RedirectRoutes
37
37
 
38
- %w{get post put delete}.each do |verb|
38
+ %w{get post put delete patch}.each do |verb|
39
39
  send verb, /.*/ do
40
40
  Response.perform(self)
41
41
  end
@@ -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
@@ -1,3 +1,4 @@
1
+ require 'active_record'
1
2
  require 'net/http'
2
3
 
3
4
  module RestAssured
@@ -1,3 +1,5 @@
1
+ require 'active_record'
2
+
1
3
  module RestAssured
2
4
  module Models
3
5
  class Redirect < ActiveRecord::Base
@@ -1,3 +1,5 @@
1
+ require 'active_record'
2
+
1
3
  module RestAssured
2
4
  module Models
3
5
  class Request < ActiveRecord::Base
@@ -1,3 +1,3 @@
1
1
  module RestAssured
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
@@ -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 an unknown request" do
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
@@ -20,7 +20,7 @@ require 'rack/test'
20
20
  require 'awesome_print'
21
21
  require 'rest-assured/config'
22
22
 
23
- DB_OPTS = { :adapter => 'postgresql' }
23
+ DB_OPTS = { :adapter => 'sqlite' }
24
24
  RestAssured::Config.build(DB_OPTS)
25
25
 
26
26
  require 'rest-assured'
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.1
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: 2015-05-09 00:00:00.000000000 Z
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.4.5
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