rack-rest-rspec 0.0.1a → 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 +7 -0
  2. data/Gemfile +20 -0
  3. data/README.md +78 -0
  4. data/Rakefile +7 -13
  5. data/VERSION +1 -1
  6. data/rack-rest-rspec.gemspec +11 -12
  7. metadata +42 -148
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0d789211724035f08b5ce1adccabadddbd7b5409961ac77e70a7158854564e5f
4
+ data.tar.gz: a81ab341b305adf605099f47a1af7af0841b8902260b2d915d911442dfebee88
5
+ SHA512:
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"
@@ -12,7 +14,11 @@ require 'yard/rake/yardoc_task.rb'
12
14
  require "rake/tasklib"
13
15
  require "roodi"
14
16
  require "roodi_task"
15
- require 'rake/version_task'
17
+
18
+
19
+ task default: :spec
20
+
21
+ Rake::VersionTask.new
16
22
 
17
23
  RoodiTask.new() do | t |
18
24
  t.patterns = %w(lib/**/*.rb)
@@ -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
54
 
59
- task :default => [:gem]
60
- Rake::VersionTask.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1a
1
+ 0.0.2
@@ -1,32 +1,31 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rack-rest-rspec/version'
4
+
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rack-rest-rspec"
8
- spec.version = RackRestRspec::VERSION
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_development_dependency "version", "~> 1.0",'>= 1.0.0'
29
- 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"
30
29
 
31
30
 
32
31
  end
metadata CHANGED
@@ -1,225 +1,122 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-rest-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1a
5
- prerelease: 5
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Romain GEORGES
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-11-02 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: bundler
14
+ name: roodi
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '1.5'
19
+ version: '5.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.5'
26
+ version: '5.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rspec
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
- - - ~>
31
+ - - "~>"
52
32
  - !ruby/object:Gem::Version
53
- version: '2.14'
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
56
- version: 2.14.1
33
+ version: '13.0'
57
34
  type: :development
58
35
  prerelease: false
59
36
  version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
37
  requirements:
62
- - - ~>
63
- - !ruby/object:Gem::Version
64
- version: '2.14'
65
- - - ! '>='
38
+ - - "~>"
66
39
  - !ruby/object:Gem::Version
67
- version: 2.14.1
40
+ version: '13.0'
68
41
  - !ruby/object:Gem::Dependency
69
- name: yard
70
- requirement: !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- version: '0.8'
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: 0.8.7.2
79
- type: :development
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ~>
85
- - !ruby/object:Gem::Version
86
- version: '0.8'
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: 0.8.7.2
90
- - !ruby/object:Gem::Dependency
91
- name: rdoc
42
+ name: code_statistics
92
43
  requirement: !ruby/object:Gem::Requirement
93
- none: false
94
44
  requirements:
95
- - - ~>
96
- - !ruby/object:Gem::Version
97
- version: '4.0'
98
- - - ! '>='
45
+ - - "~>"
99
46
  - !ruby/object:Gem::Version
100
- version: 4.0.1
47
+ version: 0.2.13
101
48
  type: :development
102
49
  prerelease: false
103
50
  version_requirements: !ruby/object:Gem::Requirement
104
- none: false
105
51
  requirements:
106
- - - ~>
107
- - !ruby/object:Gem::Version
108
- version: '4.0'
109
- - - ! '>='
52
+ - - "~>"
110
53
  - !ruby/object:Gem::Version
111
- version: 4.0.1
54
+ version: 0.2.13
112
55
  - !ruby/object:Gem::Dependency
113
- name: roodi
56
+ name: rspec
114
57
  requirement: !ruby/object:Gem::Requirement
115
- none: false
116
58
  requirements:
117
- - - ~>
118
- - !ruby/object:Gem::Version
119
- version: '3.1'
120
- - - ! '>='
59
+ - - "~>"
121
60
  - !ruby/object:Gem::Version
122
- version: 3.1.1
61
+ version: '3.11'
123
62
  type: :development
124
63
  prerelease: false
125
64
  version_requirements: !ruby/object:Gem::Requirement
126
- none: false
127
65
  requirements:
128
- - - ~>
129
- - !ruby/object:Gem::Version
130
- version: '3.1'
131
- - - ! '>='
66
+ - - "~>"
132
67
  - !ruby/object:Gem::Version
133
- version: 3.1.1
68
+ version: '3.11'
134
69
  - !ruby/object:Gem::Dependency
135
- name: code_statistics
70
+ name: yard
136
71
  requirement: !ruby/object:Gem::Requirement
137
- none: false
138
72
  requirements:
139
- - - ~>
73
+ - - "~>"
140
74
  - !ruby/object:Gem::Version
141
- version: '0.2'
142
- - - ! '>='
143
- - !ruby/object:Gem::Version
144
- version: 0.2.13
75
+ version: 0.9.28
145
76
  type: :development
146
77
  prerelease: false
147
78
  version_requirements: !ruby/object:Gem::Requirement
148
- none: false
149
79
  requirements:
150
- - - ~>
80
+ - - "~>"
151
81
  - !ruby/object:Gem::Version
152
- version: '0.2'
153
- - - ! '>='
154
- - !ruby/object:Gem::Version
155
- version: 0.2.13
82
+ version: 0.9.28
156
83
  - !ruby/object:Gem::Dependency
157
84
  name: yard-rspec
158
85
  requirement: !ruby/object:Gem::Requirement
159
- none: false
160
86
  requirements:
161
- - - ~>
87
+ - - "~>"
162
88
  - !ruby/object:Gem::Version
163
89
  version: '0.1'
164
90
  type: :development
165
91
  prerelease: false
166
92
  version_requirements: !ruby/object:Gem::Requirement
167
- none: false
168
93
  requirements:
169
- - - ~>
94
+ - - "~>"
170
95
  - !ruby/object:Gem::Version
171
96
  version: '0.1'
172
- - !ruby/object:Gem::Dependency
173
- name: version
174
- requirement: !ruby/object:Gem::Requirement
175
- none: false
176
- requirements:
177
- - - ~>
178
- - !ruby/object:Gem::Version
179
- version: '1.0'
180
- - - ! '>='
181
- - !ruby/object:Gem::Version
182
- version: 1.0.0
183
- type: :development
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
- requirements:
188
- - - ~>
189
- - !ruby/object:Gem::Version
190
- version: '1.0'
191
- - - ! '>='
192
- - !ruby/object:Gem::Version
193
- version: 1.0.0
194
97
  - !ruby/object:Gem::Dependency
195
98
  name: rack-test
196
99
  requirement: !ruby/object:Gem::Requirement
197
- none: false
198
100
  requirements:
199
- - - ~>
101
+ - - "~>"
200
102
  - !ruby/object:Gem::Version
201
- version: '0.6'
202
- - - ! '>='
203
- - !ruby/object:Gem::Version
204
- version: 0.6.3
103
+ version: '2.0'
205
104
  type: :runtime
206
105
  prerelease: false
207
106
  version_requirements: !ruby/object:Gem::Requirement
208
- none: false
209
107
  requirements:
210
- - - ~>
211
- - !ruby/object:Gem::Version
212
- version: '0.6'
213
- - - ! '>='
108
+ - - "~>"
214
109
  - !ruby/object:Gem::Version
215
- version: 0.6.3
216
- description: ! 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice '
110
+ version: '2.0'
111
+ description: 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice '
217
112
  email:
218
113
  - romain@ultragreen.net
219
114
  executables: []
220
115
  extensions: []
221
116
  extra_rdoc_files: []
222
117
  files:
118
+ - Gemfile
119
+ - README.md
223
120
  - Rakefile
224
121
  - VERSION
225
122
  - lib/rack-rest-rspec/helpers/hash.rb
@@ -239,27 +136,24 @@ files:
239
136
  homepage: http://github.com/Ultragreen/rack-rest-rspec
240
137
  licenses:
241
138
  - BSD-2
139
+ metadata: {}
242
140
  post_install_message:
243
141
  rdoc_options: []
244
142
  require_paths:
245
143
  - lib
246
144
  required_ruby_version: !ruby/object:Gem::Requirement
247
- none: false
248
145
  requirements:
249
- - - ! '>='
146
+ - - ">="
250
147
  - !ruby/object:Gem::Version
251
148
  version: '0'
252
149
  required_rubygems_version: !ruby/object:Gem::Requirement
253
- none: false
254
150
  requirements:
255
- - - ! '>'
151
+ - - ">="
256
152
  - !ruby/object:Gem::Version
257
- version: 1.3.1
153
+ version: '0'
258
154
  requirements: []
259
- rubyforge_project:
260
- rubygems_version: 1.8.23
155
+ rubygems_version: 3.1.2
261
156
  signing_key:
262
- specification_version: 3
263
- summary: ! 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice'
157
+ specification_version: 4
158
+ summary: 'Rack-rest-rspec: RSpec Matchers for REST Rack webservice'
264
159
  test_files: []
265
- has_rdoc: