rest_shifter 0.0.7 → 0.0.9

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: c510520a79c89ecd92ffdaf4fbb43a048eba39ba
4
- data.tar.gz: 7c9edb85114a5047d269e6fc112f23d1c564b815
3
+ metadata.gz: d6f15a8fc602a8726f2137096908e68e0fb4e0b6
4
+ data.tar.gz: 6873533a73cfa67d631d91ef35f23acceeeb687b
5
5
  SHA512:
6
- metadata.gz: 251a0b4a93ea5c826ae779b3e630226ed5ecf10eb32134d9084923518677b350797c36509fb34f52d329f9296a862dc8937ef59afea3d4d13ff8ac6d44aab2be
7
- data.tar.gz: ee80cec70ff6381310a1f2fdde318d1dfa7a53272991c910b70cdb74aea55990076760ab2aeeb47e74751e02cdba485bd88d5f97317838cc5746d9235b2a8d2d
6
+ metadata.gz: d0c46c048dac34dd6d3a39f2bbd8718d42933bb2ed28b835fea857211b3df1904da2c45c1bbb9fa282e2d07160ada92c333379af1efb11e4ee2c7192bd6febd3
7
+ data.tar.gz: 60487cbb1b9ec627a7a56ef666b09a66e0909dba8f8809ab10493b1a4c74d32bab9412b066a9b87dde2e6d772b6441b20cf7ecd638f90f4f24335bf989ed6016
data/.gitignore CHANGED
@@ -26,7 +26,7 @@ build/
26
26
 
27
27
  # for a library or gem, you might want to ignore these files since the code is
28
28
  # intended to run in multiple environments; otherwise, check them in:
29
- # Gemfile.lock
29
+ Gemfile.lock
30
30
  # .ruby-version
31
31
  # .ruby-gemset
32
32
 
data/CHANGES CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ ** 0.0.9
3
+ - Bugfix
4
+ -- Fixing command -c create to include response sleep
5
+
6
+ ** 0.0.8
7
+ - Feature
8
+ -- adding sleep funtion, to simulate response time and timeouts
9
+
2
10
  ** 0.0.7
3
11
  - Temp hack: RACK_ENV=testing
4
12
  -- using enviroment variable to define if we are or not using testing flavour folder
@@ -9,6 +9,7 @@ class RestShifter::Commands::Create
9
9
  File.open(dirname + "/" + name, 'w') {|f| f.write(
10
10
  'method_used = "get"
11
11
  path = "/hello_world"
12
+ response_sleep = 0
12
13
  response_status = "200"
13
14
  response_body = "{ \"hello_world\" : \"Your service is working fine. :D\" }"
14
15
  response_content_type = "application/json"') }
@@ -24,6 +24,7 @@ class Shifter < Sinatra::Base
24
24
 
25
25
  gets.each do |service|
26
26
  get service.path do
27
+ sleep service.response_sleep
27
28
  status service.response_status
28
29
  content_type service.response_content_type
29
30
  service.response_body
@@ -32,6 +33,7 @@ class Shifter < Sinatra::Base
32
33
 
33
34
  posts.each do |service|
34
35
  post service.path do
36
+ sleep service.response_sleep
35
37
  status service.response_status
36
38
  content_type service.response_content_type
37
39
  service.response_body
@@ -1,3 +1,3 @@
1
1
  module RestShifter
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -2,6 +2,7 @@ method_used = "get"
2
2
  path = "/notfound"
3
3
  request_accept = nil
4
4
  request_content_type = nil
5
+ response_sleep = 0
5
6
  response_status = "404"
6
7
  response_body = "Not Found"
7
8
  response_content_type = "application/foo.company.product.type-version+json"
@@ -2,6 +2,7 @@ method_used = "post"
2
2
  path = "/notfound"
3
3
  request_accept = nil
4
4
  request_content_type = nil
5
+ response_sleep = 0
5
6
  response_status = "404"
6
7
  response_body = "Not Found"
7
8
  response_content_type = "application/foo.company.product.type-version+json"
@@ -0,0 +1,8 @@
1
+ method_used = "get"
2
+ path = "/sleep"
3
+ request_accept = nil
4
+ request_content_type = nil
5
+ response_sleep = 1
6
+ response_status = "200"
7
+ response_body = "This should sleep for one second"
8
+ response_content_type = "application/json"
@@ -16,6 +16,7 @@ request_cookies = nil
16
16
  request_url = nil
17
17
  request_path = nil
18
18
  request_ip = nil
19
+ response_sleep = 0
19
20
  response_status = "200"
20
21
  response_body = "success"
21
22
  response_content_type = "application/json"
@@ -2,6 +2,7 @@ method_used = "post"
2
2
  path = "/ok"
3
3
  request_accept = nil
4
4
  request_content_type = nil
5
+ response_sleep = 0
5
6
  response_status = "200"
6
7
  response_body = "success"
7
8
  response_content_type = "application/json"
data/spec/service_spec.rb CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '../lib/rest_shifter/shifter.rb')
3
3
 
4
4
  describe RestShifter do
5
5
 
6
- def app
6
+ def app
7
7
  Shifter.set :path_to_flavors, File.join(File.dirname(__FILE__), "../../spec/flavors")
8
8
  end
9
9
 
@@ -40,5 +40,15 @@ describe RestShifter do
40
40
  end
41
41
 
42
42
  end
43
+ describe "Special behaviours" do
44
+ it "Service should sleep for a second" do
45
+ time = Time.now
46
+ get '/sleep'
47
+ expect(Time.now - time).to be > 1
48
+ expect(last_response.status).to eq(200)
49
+ expect(last_response.body).to eq("This should sleep for one second")
50
+ expect(last_response.headers['Content-Type']).to eq("application/json")
51
+ end
52
+ end
43
53
  end
44
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_shifter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camilo Ribeiro
@@ -178,7 +178,6 @@ files:
178
178
  - .travis.yml
179
179
  - CHANGES
180
180
  - Gemfile
181
- - Gemfile.lock
182
181
  - LICENSE
183
182
  - README.md
184
183
  - Rakefile
@@ -195,6 +194,7 @@ files:
195
194
  - rest_shifter.gemspec
196
195
  - spec/flavors/notfound_get.flavor
197
196
  - spec/flavors/notfound_post.flavor
197
+ - spec/flavors/sleep_get.flavor
198
198
  - spec/flavors/success_get.flavor
199
199
  - spec/flavors/success_post.flavor
200
200
  - spec/service_spec.rb
@@ -226,6 +226,7 @@ summary: Simple Rest Mock service
226
226
  test_files:
227
227
  - spec/flavors/notfound_get.flavor
228
228
  - spec/flavors/notfound_post.flavor
229
+ - spec/flavors/sleep_get.flavor
229
230
  - spec/flavors/success_get.flavor
230
231
  - spec/flavors/success_post.flavor
231
232
  - spec/service_spec.rb
data/Gemfile.lock DELETED
@@ -1,92 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rest_shifter (0.0.6)
5
- icecream
6
- sinatra
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- builder (3.2.2)
12
- coderay (1.1.0)
13
- coveralls (0.7.9)
14
- multi_json (~> 1.10)
15
- rest-client (~> 1.7)
16
- simplecov (~> 0.9.1)
17
- term-ansicolor (~> 1.3)
18
- thor (~> 0.19.1)
19
- cucumber (1.3.19)
20
- builder (>= 2.1.2)
21
- diff-lcs (>= 1.1.3)
22
- gherkin (~> 2.12)
23
- multi_json (>= 1.7.5, < 2.0)
24
- multi_test (>= 0.1.2)
25
- diff-lcs (1.2.5)
26
- docile (1.1.5)
27
- gherkin (2.12.2)
28
- multi_json (~> 1.3)
29
- icecream (0.0.14)
30
- method_source (0.8.2)
31
- mime-types (2.4.3)
32
- multi_json (1.10.1)
33
- multi_test (0.1.2)
34
- netrc (0.10.2)
35
- nyan-cat-formatter (0.11)
36
- rspec (>= 2.99, >= 2.14.2, < 4)
37
- pry (0.10.1)
38
- coderay (~> 1.1.0)
39
- method_source (~> 0.8.1)
40
- slop (~> 3.4)
41
- rack (1.6.0)
42
- rack-protection (1.5.3)
43
- rack
44
- rack-test (0.6.3)
45
- rack (>= 1.0)
46
- rake (10.4.2)
47
- rest-client (1.7.2)
48
- mime-types (>= 1.16, < 3.0)
49
- netrc (~> 0.7)
50
- rspec (3.2.0)
51
- rspec-core (~> 3.2.0)
52
- rspec-expectations (~> 3.2.0)
53
- rspec-mocks (~> 3.2.0)
54
- rspec-core (3.2.0)
55
- rspec-support (~> 3.2.0)
56
- rspec-expectations (3.2.0)
57
- diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.2.0)
59
- rspec-mocks (3.2.0)
60
- diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.2.0)
62
- rspec-support (3.2.1)
63
- simplecov (0.9.1)
64
- docile (~> 1.1.0)
65
- multi_json (~> 1.0)
66
- simplecov-html (~> 0.8.0)
67
- simplecov-html (0.8.0)
68
- sinatra (1.4.5)
69
- rack (~> 1.4)
70
- rack-protection (~> 1.4)
71
- tilt (~> 1.3, >= 1.3.4)
72
- slop (3.6.0)
73
- term-ansicolor (1.3.0)
74
- tins (~> 1.0)
75
- thor (0.19.1)
76
- tilt (1.4.1)
77
- tins (1.3.4)
78
-
79
- PLATFORMS
80
- ruby
81
-
82
- DEPENDENCIES
83
- coveralls
84
- cucumber
85
- nyan-cat-formatter
86
- pry
87
- rack-test
88
- rake
89
- rest-client
90
- rest_shifter!
91
- rspec
92
- simplecov