rack-rest-rspec 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +20 -0
  3. data/README.md +78 -0
  4. data/Rakefile +6 -12
  5. data/VERSION +1 -1
  6. data/rack-rest-rspec.gemspec +10 -10
  7. metadata +24 -86
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4eb2d19e331be1cd12bce9ce623ed1844c181c7fcacb8960acb2c4e973dd2bd4
4
- data.tar.gz: 3b508c8c0b42e6bf2e6f2f9d475fc97b0fd7209270d445ba7fb8ae7e53dcbfd4
3
+ metadata.gz: 0d789211724035f08b5ce1adccabadddbd7b5409961ac77e70a7158854564e5f
4
+ data.tar.gz: a81ab341b305adf605099f47a1af7af0841b8902260b2d915d911442dfebee88
5
5
  SHA512:
6
- metadata.gz: 77d1fcb75c1082c6805bbb7b0d2985b5ffbb68d487af73014b75aad83feead049acf6e2bfe683f6c4ba5a1d63d90dfee0f66a81d345d59db0bb2b43ac13a280c
7
- data.tar.gz: 94caf0509356b636482b841aca8e9b5a4ef1a06438480d6498b8feeeedc935880ecb7d79ab4f74484922edbd702c2b67b5aafb38993f267dfceabca947890fa7
6
+ metadata.gz: 34d61192e292c62781d039766a19aabc8baf5d601aabb626b715303bccce6c1e84bd670f5cf49df83271d727421784c59a9cf2d0f1045165beaeed467dceb920
7
+ data.tar.gz: 6e487bec4bc746d540ee2668635f8fa03fdfafc44f24e5811e6fad54527071a5b20b7a761a2d7a5c503f02d5635779d58552e9be2ffb9a90e1e8468f1bace39a
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ group :test, :development do
8
+ gem "roodi", "~> 5.0"
9
+ gem "rake", "~> 13.0"
10
+ gem "code_statistics", "~> 0.2.13"
11
+ gem "rspec", "~> 3.11"
12
+ gem "yard", "~> 0.9.28"
13
+ gem "yard-rspec", "~> 0.1"
14
+ end
15
+
16
+ gem "rack-test", "~> 2.0"
17
+
18
+
19
+
20
+ gem "version", "~> 1.1"
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Rack REST RSpec
2
+
3
+ RSpec Matchers for REST Rack webservice
4
+
5
+
6
+ Install it yourself as:
7
+
8
+ $ gem install rack-rest-rspec
9
+
10
+ or
11
+
12
+ $ bundle add 'rack-rest-rspec'
13
+
14
+ ## Usage
15
+
16
+ ### Basic usage : install in your spec/spec_helper.rb or spec/prepare.rb
17
+
18
+ require 'rack-rest-rspec/prepare'
19
+
20
+ ### Basic usage : sample of spec matchers usage
21
+
22
+ describe 'Posts REST API' do
23
+ before :all do
24
+ $service = RestService::new :service => MYRack::ModularApp
25
+ end
26
+
27
+ subject { $service }
28
+ context "GET /api/v1/posts : test for a collections of Post (empty)" do
29
+ it { expect(subject.get('/api/v1/posts')).to be_correctly_sent }
30
+ it { expect(subject).to respond_with_status 200 }
31
+ it { expect(subject).to respond_a_collection_of_record }
32
+ it { expect(subject).to respond_with_collection_size 0 }
33
+ end
34
+
35
+ context "POST /api/v1/post : create a new record" do
36
+ it { expect(subject.post('/api/v1/post',{id: 1, title: "test", body: "content"}.to_json)).to be_correctly_sent }
37
+ it { expect(subject).to respond_with_status 201 }
38
+ end
39
+
40
+ context "GET /api/v1/posts : test for a collections of Post" do
41
+ it { expect(subject.get('/api/v1/posts')).to be_correctly_sent }
42
+ it { expect(subject).to respond_with_status 200 }
43
+ it { expect(subject).to respond_a_collection_of_record }
44
+ it { expect(subject).to respond_with_collection_size 1 }
45
+ end
46
+
47
+ context "GET /api/v1/post/:id : get a record by code" do
48
+ it { expect(subject.get("/api/v1/post/1")).to be_correctly_sent }
49
+ it { expect(subject).to respond_with_status 200 }
50
+ it { expect(subject).to respond_a_record }
51
+ it { expect(subject).to respond_with_data({id: 1, title: "test", body: "content"}) }
52
+ end
53
+
54
+ context "DELETE /api/v1/post/:id : delete a pots by id" do
55
+ it{ expect(subject.delete("/api/v1/post/1")).to be_correctly_sent }
56
+ it { expect(subject).to respond_with_status 204 }
57
+ end
58
+
59
+
60
+
61
+ end
62
+
63
+
64
+ ## Available matchers :
65
+
66
+ * be_correctly_send : check if return is HTTP valid
67
+ * respond_with_a_collection_of_record : check if the return is a JSON Array
68
+ * respond_a_record : check if the return is a JSON Hash
69
+ * respond_with_collection_size <Integer> : check if the collection have the good size
70
+ * respond_with_data <Object> : check if the return match the given object
71
+ * respond_with_status <Integer> : check if the HTTP response code is the good.
72
+
73
+
74
+
75
+
76
+
77
+
78
+
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'rubygems'
3
+ require 'version'
4
+ require 'rake/version_task'
3
5
  require 'rspec'
4
6
  require 'rake'
5
7
  require "rake/clean"
@@ -14,6 +16,10 @@ require "roodi"
14
16
  require "roodi_task"
15
17
 
16
18
 
19
+ task default: :spec
20
+
21
+ Rake::VersionTask.new
22
+
17
23
  RoodiTask.new() do | t |
18
24
  t.patterns = %w(lib/**/*.rb)
19
25
  t.config = "ultragreen_roodi_coding_convention.yml"
@@ -45,16 +51,4 @@ end
45
51
  task :clobber => "yardoc:clobber"
46
52
 
47
53
 
48
- Gem::PackageTask.new(spec) do |pkg|
49
- pkg.need_tar = true
50
- pkg.need_zip = true
51
- end
52
-
53
- Rake::RDocTask.new('rdoc') do |d|
54
- d.rdoc_files.include('doc/**/*','bin/*')
55
- d.title = 'Dorsal : Yard'
56
- d.options << '--line-numbers' << '--diagram' << '-SHN'
57
- end
58
-
59
- task :default => [:gem]
60
54
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1a
1
+ 0.0.2
@@ -5,27 +5,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rack-rest-rspec"
8
- spec.version = "0.0.1"
8
+ spec.version = `cat VERSION`
9
9
  spec.authors = ["Romain GEORGES"]
10
10
  spec.email = ["romain@ultragreen.net"]
11
11
  spec.summary = %q{Rack-rest-rspec: RSpec Matchers for REST Rack webservice }
12
12
  spec.description = %q{Rack-rest-rspec: RSpec Matchers for REST Rack webservice }
13
13
  spec.homepage = "http://github.com/Ultragreen/rack-rest-rspec"
14
14
  spec.license = "BSD-2"
15
+
15
16
  spec.files = `git ls-files -z`.split("\x0")
16
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
19
  spec.require_paths = ["lib"]
19
20
 
20
- spec.add_development_dependency "bundler", "~> 1.5"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.1'
23
- spec.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.2'
24
- spec.add_development_dependency 'rdoc', '~> 4.0', '>= 4.0.1'
25
- spec.add_development_dependency 'roodi', '~> 3.1', '>= 3.1.1'
26
- spec.add_development_dependency 'code_statistics', '~> 0.2', '>= 0.2.13'
27
- spec.add_development_dependency 'yard-rspec', '~> 0.1'
28
- spec.add_runtime_dependency "rack-test", "~> 0.6", ">= 0.6.3"
21
+ spec.add_development_dependency "roodi", "~> 5.0"
22
+ spec.add_development_dependency "rake", "~> 13.0"
23
+ spec.add_development_dependency "code_statistics", "~> 0.2.13"
24
+ spec.add_development_dependency "rspec", "~> 3.11"
25
+ spec.add_development_dependency "yard", "~> 0.9.28"
26
+ spec.add_development_dependency "yard-rspec", "~> 0.1"
27
+
28
+ spec.add_runtime_dependency "rack-test", "~> 2.0"
29
29
 
30
30
 
31
31
  end
metadata CHANGED
@@ -1,143 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-rest-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain GEORGES
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-09 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: roodi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '5.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.14'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 2.14.1
51
- type: :development
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: '2.14'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 2.14.1
61
- - !ruby/object:Gem::Dependency
62
- name: yard
63
29
  requirement: !ruby/object:Gem::Requirement
64
30
  requirements:
65
31
  - - "~>"
66
32
  - !ruby/object:Gem::Version
67
- version: '0.8'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 0.8.7.2
33
+ version: '13.0'
71
34
  type: :development
72
35
  prerelease: false
73
36
  version_requirements: !ruby/object:Gem::Requirement
74
37
  requirements:
75
38
  - - "~>"
76
39
  - !ruby/object:Gem::Version
77
- version: '0.8'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 0.8.7.2
40
+ version: '13.0'
81
41
  - !ruby/object:Gem::Dependency
82
- name: rdoc
42
+ name: code_statistics
83
43
  requirement: !ruby/object:Gem::Requirement
84
44
  requirements:
85
45
  - - "~>"
86
46
  - !ruby/object:Gem::Version
87
- version: '4.0'
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: 4.0.1
47
+ version: 0.2.13
91
48
  type: :development
92
49
  prerelease: false
93
50
  version_requirements: !ruby/object:Gem::Requirement
94
51
  requirements:
95
52
  - - "~>"
96
53
  - !ruby/object:Gem::Version
97
- version: '4.0'
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: 4.0.1
54
+ version: 0.2.13
101
55
  - !ruby/object:Gem::Dependency
102
- name: roodi
56
+ name: rspec
103
57
  requirement: !ruby/object:Gem::Requirement
104
58
  requirements:
105
59
  - - "~>"
106
60
  - !ruby/object:Gem::Version
107
- version: '3.1'
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 3.1.1
61
+ version: '3.11'
111
62
  type: :development
112
63
  prerelease: false
113
64
  version_requirements: !ruby/object:Gem::Requirement
114
65
  requirements:
115
66
  - - "~>"
116
67
  - !ruby/object:Gem::Version
117
- version: '3.1'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 3.1.1
68
+ version: '3.11'
121
69
  - !ruby/object:Gem::Dependency
122
- name: code_statistics
70
+ name: yard
123
71
  requirement: !ruby/object:Gem::Requirement
124
72
  requirements:
125
73
  - - "~>"
126
74
  - !ruby/object:Gem::Version
127
- version: '0.2'
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: 0.2.13
75
+ version: 0.9.28
131
76
  type: :development
132
77
  prerelease: false
133
78
  version_requirements: !ruby/object:Gem::Requirement
134
79
  requirements:
135
80
  - - "~>"
136
81
  - !ruby/object:Gem::Version
137
- version: '0.2'
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- version: 0.2.13
82
+ version: 0.9.28
141
83
  - !ruby/object:Gem::Dependency
142
84
  name: yard-rspec
143
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,20 +100,14 @@ dependencies:
158
100
  requirements:
159
101
  - - "~>"
160
102
  - !ruby/object:Gem::Version
161
- version: '0.6'
162
- - - ">="
163
- - !ruby/object:Gem::Version
164
- version: 0.6.3
103
+ version: '2.0'
165
104
  type: :runtime
166
105
  prerelease: false
167
106
  version_requirements: !ruby/object:Gem::Requirement
168
107
  requirements:
169
108
  - - "~>"
170
109
  - !ruby/object:Gem::Version
171
- version: '0.6'
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- version: 0.6.3
110
+ version: '2.0'
175
111
  description: 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice '
176
112
  email:
177
113
  - romain@ultragreen.net
@@ -179,6 +115,8 @@ executables: []
179
115
  extensions: []
180
116
  extra_rdoc_files: []
181
117
  files:
118
+ - Gemfile
119
+ - README.md
182
120
  - Rakefile
183
121
  - VERSION
184
122
  - lib/rack-rest-rspec/helpers/hash.rb
@@ -199,7 +137,7 @@ homepage: http://github.com/Ultragreen/rack-rest-rspec
199
137
  licenses:
200
138
  - BSD-2
201
139
  metadata: {}
202
- post_install_message:
140
+ post_install_message:
203
141
  rdoc_options: []
204
142
  require_paths:
205
143
  - lib
@@ -214,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
152
  - !ruby/object:Gem::Version
215
153
  version: '0'
216
154
  requirements: []
217
- rubygems_version: 3.2.3
218
- signing_key:
155
+ rubygems_version: 3.1.2
156
+ signing_key:
219
157
  specification_version: 4
220
158
  summary: 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice'
221
159
  test_files: []