webspicy 0.1.0.pre.rc2 → 0.1.0.pre.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/restful/Gemfile +2 -0
- data/examples/restful/Gemfile.lock +3 -1
- data/examples/restful/app.rb +17 -0
- data/examples/restful/webspicy/todo/postTodos.yml +52 -0
- data/lib/webspicy/tester.rb +4 -2
- data/lib/webspicy/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6894d4163e21f8309c91e1befcf39ce59423e04
|
4
|
+
data.tar.gz: 61bc6deca7423852bea6daa1d5c2aacf7ec17c57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c403e240151fd262ee1982e0dbc4d839bdfcbf33e6682f5c0384fbd034b900de76871d3b6360284ee7ee29a4ad4281f57a329bb67ee053fe9e88c364d5dfbe59
|
7
|
+
data.tar.gz: 815d5fed96020fc8cc1db42443f1eaee72357793408c05f304801a34f4b5cdd7d8e0dca5883602c92eda0c94aaee11d671e6cbc33092d6871a88072b4d5e12d7
|
data/examples/restful/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
webspicy (0.0.
|
4
|
+
webspicy (0.1.0.pre.rc2)
|
5
5
|
finitio (~> 0.5.2)
|
6
6
|
http (~> 0.5)
|
7
7
|
path (~> 1.3)
|
@@ -61,6 +61,8 @@ PLATFORMS
|
|
61
61
|
ruby
|
62
62
|
|
63
63
|
DEPENDENCIES
|
64
|
+
finitio (~> 0.5.2)
|
65
|
+
path (~> 1.3)
|
64
66
|
rake (~> 10)
|
65
67
|
sinatra (~> 2.0)
|
66
68
|
webspicy!
|
data/examples/restful/app.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'json'
|
3
|
+
require 'path'
|
4
|
+
require 'finitio'
|
5
|
+
|
6
|
+
SCHEMA = Finitio::DEFAULT_SYSTEM.parse (Path.dir/'webspicy/schema.fio').read
|
3
7
|
|
4
8
|
TODOLIST = [
|
5
9
|
{
|
@@ -20,6 +24,19 @@ get '/todo/' do
|
|
20
24
|
TODOLIST.to_json
|
21
25
|
end
|
22
26
|
|
27
|
+
post '/todo/' do
|
28
|
+
content_type :json
|
29
|
+
todo = SCHEMA["Todo"].dress(JSON.load(request.body.read))
|
30
|
+
if TODOLIST.find{|t| t[:id] == todo[:id] }
|
31
|
+
status 409
|
32
|
+
{error: "Identifier already in use"}.to_json
|
33
|
+
else
|
34
|
+
TODOLIST << todo
|
35
|
+
status 201
|
36
|
+
todo.to_json
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
23
40
|
get '/todo/:id' do |id|
|
24
41
|
content_type :json
|
25
42
|
todo = TODOLIST.find{|todo| todo[:id] == Integer(id) }
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
name: |-
|
3
|
+
Todo
|
4
|
+
|
5
|
+
url: |-
|
6
|
+
/todo/
|
7
|
+
|
8
|
+
services:
|
9
|
+
- method: |-
|
10
|
+
POST
|
11
|
+
|
12
|
+
description: |-
|
13
|
+
Creates a new todo item
|
14
|
+
|
15
|
+
preconditions: |-
|
16
|
+
|
17
|
+
input_schema: |-
|
18
|
+
Todo
|
19
|
+
|
20
|
+
output_schema: |-
|
21
|
+
Todo
|
22
|
+
|
23
|
+
error_schema: |-
|
24
|
+
{
|
25
|
+
error: String
|
26
|
+
}
|
27
|
+
|
28
|
+
examples:
|
29
|
+
|
30
|
+
- description: |-
|
31
|
+
when requested with a non existing ID
|
32
|
+
params:
|
33
|
+
id: 3
|
34
|
+
description: "Hello World"
|
35
|
+
expected:
|
36
|
+
content_type: application/json
|
37
|
+
status: 201
|
38
|
+
assert:
|
39
|
+
- "pathFD('', id: 3)"
|
40
|
+
|
41
|
+
counterexamples:
|
42
|
+
|
43
|
+
- description: |-
|
44
|
+
when requested while the id already exists
|
45
|
+
params:
|
46
|
+
id: 1
|
47
|
+
description: "Hello World"
|
48
|
+
expected:
|
49
|
+
content_type: application/json
|
50
|
+
status: 409
|
51
|
+
assert:
|
52
|
+
- "pathFD('', error: 'Identifier already in use')"
|
data/lib/webspicy/tester.rb
CHANGED
@@ -17,10 +17,11 @@ module Webspicy
|
|
17
17
|
|
18
18
|
before(:all) do
|
19
19
|
client.before(test_case, service, resource)
|
20
|
+
@invocation ||= client.call(test_case, service, resource)
|
20
21
|
end
|
21
22
|
|
22
23
|
subject do
|
23
|
-
@invocation
|
24
|
+
@invocation
|
24
25
|
end
|
25
26
|
|
26
27
|
it 'can be invoked successfuly' do
|
@@ -52,10 +53,11 @@ module Webspicy
|
|
52
53
|
|
53
54
|
before(:all) do
|
54
55
|
client.before(test_case, service, resource)
|
56
|
+
@invocation ||= client.call(test_case, service, resource)
|
55
57
|
end
|
56
58
|
|
57
59
|
subject do
|
58
|
-
@invocation
|
60
|
+
@invocation
|
59
61
|
end
|
60
62
|
|
61
63
|
it 'can be invoked successfuly' do
|
data/lib/webspicy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webspicy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- examples/restful/webspicy/schema.fio
|
98
98
|
- examples/restful/webspicy/todo/getTodo.yml
|
99
99
|
- examples/restful/webspicy/todo/getTodos.yml
|
100
|
+
- examples/restful/webspicy/todo/postTodos.yml
|
100
101
|
- lib/webspicy.rb
|
101
102
|
- lib/webspicy/checker.rb
|
102
103
|
- lib/webspicy/client.rb
|