rspec-api 0.1.2 → 0.2.0

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: c57c8cdc4f5827c53876cb303f2bea89fefae297
4
- data.tar.gz: 4ae692036878221cd3d1cadc572f13d5c1b9a913
3
+ metadata.gz: dc5683375460c14700afc17d12e045bb5acac528
4
+ data.tar.gz: c218c3741e024db99c24862a87092b5b4fe54594
5
5
  SHA512:
6
- metadata.gz: 4f2bc0c289191ddb64a0c936e04c861afeed46516f2e4d00edf609888fcbe8a9cbed8ddad9a9da09f6e1cd9f42bc0f9bcfcd014d59adcc8afc75dd14196e63e6
7
- data.tar.gz: 15437e3057b40d9121253bbe42257967943b5455d2655aae305a9674599de50c6a5a30fa735338791ed6fc75e9aba1ac893581e86b470065c782f4cc369d5f19
6
+ metadata.gz: 1d9f72802f506ee2532df49b3d5e64b0cebb0535fc802f557b74e297c4996da73c80d1ded42dc6cdd44bd4e5a745c137df8823049ee1eabce14a96313f8f4050
7
+ data.tar.gz: e2d6254c1fe55f4a2ae6ce6086d92a734e5cdd3bfd905ac8090423a37278e40f71eb58c7d56ef4ad6528a183a21048506ff4033658a287fb5c1ad3f5834ee6c8
data/README.md CHANGED
@@ -1,3 +1,16 @@
1
- # RSpec API
1
+ RSpec API
2
+ =========
2
3
 
3
- More info at [http://rspec-api.github.io](http://rspec-api.github.io)
4
+ More info at [http://rspec-api.github.io](http://rspec-api.github.io)
5
+
6
+ [![Build Status](https://travis-ci.org/rspec-api/rspec-api.png)](https://travis-ci.org/rspec-api/rspec-api)
7
+ [![Code Climate](https://codeclimate.com/github/rspec-api/rspec-api.png)](https://codeclimate.com/github/rspec-api/rspec-api)
8
+ [![Coverage Status](https://coveralls.io/repos/rspec-api/rspec-api/badge.png)](https://coveralls.io/r/rspec-api/rspec-api)
9
+ [![Dependency Status](https://gemnasium.com/rspec-api/rspec-api.png)](https://gemnasium.com/rspec-api/rspec-api)
10
+
11
+ How to test
12
+ ===========
13
+
14
+ * Create a new [GitHub personal authentication token](https://github.com/settings/applications)
15
+ * Store it in an environment variable called `RSPEC_API_GITHUB_TOKEN` (e.g., on OS X, type `export RSPEC_API_GITHUB_TOKEN=...`)
16
+ * Run `rspec`
@@ -1,3 +1,4 @@
1
+ require 'rack/utils'
1
2
  require 'rspec-api/dsl/request/status'
2
3
  require 'rspec-api/dsl/request/headers'
3
4
  require 'rspec-api/dsl/request/body'
@@ -51,7 +52,7 @@ module DSL
51
52
  end
52
53
 
53
54
  def has_entity_body?(status_code)
54
- Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.exclude? status_code
55
+ !Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status_code
55
56
  end
56
57
 
57
58
  def success?(status_code)
@@ -1,6 +1,7 @@
1
+ require 'active_support'
1
2
  module DSL
2
3
  module Resource
3
- extend ActiveSupport::Concern
4
+ extend ::ActiveSupport::Concern
4
5
 
5
6
  module ClassMethods
6
7
  def rspec_api
@@ -1,3 +1,6 @@
1
+ require 'active_support/core_ext/object' # present?
2
+
3
+
1
4
  module DSL
2
5
  module Route
3
6
  extend ActiveSupport::Concern
@@ -107,8 +110,8 @@ module DSL
107
110
  end
108
111
 
109
112
  def parse_request_arguments(args)
110
- text = args.first.is_a?(String) ? args.first : ''
111
- values = args.first.is_a?(String) ? args.second : args.first
113
+ text = args.first.is_a?(String) ? args[0] : ''
114
+ values = args.first.is_a?(String) ? args[1] : args[0]
112
115
  [text, values || {}] # NOTE: In Ruby 2.0 we could write values.to_h
113
116
  end
114
117
  end
@@ -8,7 +8,7 @@ module Http
8
8
 
9
9
  conn = Faraday.new 'https://api.github.com/' do |c| # TODO: Pass host as a parameter
10
10
  # NOTE: The order is **important**! Leave HttpCache first
11
- c.use Faraday::HttpCache, store: :file_store, store_options: ['/tmp/faraday'], logger: logger
11
+ c.use Faraday::HttpCache, serializer: Marshal, store: :file_store, store_options: ['/tmp/faraday'], logger: logger
12
12
  c.use FaradayMiddleware::EncodeJson # query params are not JSON(body) but data are
13
13
  c.use Faraday::Response::Logger, logger
14
14
  c.use Faraday::Adapter::NetHttp
@@ -1,3 +1,3 @@
1
1
  module RspecApi
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,15 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activerecord
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '4.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '4.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: railties
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: kaminari
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: api-pagination
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: jbuilder
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
13
167
  - !ruby/object:Gem::Dependency
14
168
  name: faraday
15
169
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +206,37 @@ dependencies:
52
206
  - - '>='
53
207
  - !ruby/object:Gem::Version
54
208
  version: 0.3.0
55
- description: Helpers to write specs for web APIs
209
+ - !ruby/object:Gem::Dependency
210
+ name: rake
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: coveralls
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - '>='
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ description: |-
238
+ When you write a web API, you make a promise to the world.
239
+ RSpec API helps you keep your promise.
56
240
  email:
57
241
  - claudiob@gmail.com
58
242
  executables: []
@@ -69,7 +253,6 @@ files:
69
253
  - lib/rspec-api/http/local/request.rb
70
254
  - lib/rspec-api/http/local/route.rb
71
255
  - lib/rspec-api/http/local.rb
72
- - lib/rspec-api/http/rack_test.rb
73
256
  - lib/rspec-api/http/remote/request.rb
74
257
  - lib/rspec-api/http/remote/resource.rb
75
258
  - lib/rspec-api/http/remote/route.rb
@@ -100,7 +283,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
283
  requirements:
101
284
  - - '>='
102
285
  - !ruby/object:Gem::Version
103
- version: 1.9.0
286
+ version: 1.9.3
104
287
  required_rubygems_version: !ruby/object:Gem::Requirement
105
288
  requirements:
106
289
  - - '>='
@@ -111,6 +294,6 @@ rubyforge_project:
111
294
  rubygems_version: 2.1.5
112
295
  signing_key:
113
296
  specification_version: 4
114
- summary: Extends rspec_api_documentation with methods to write more compact and meaningful,
115
- auto-documented specs for web APIs.
297
+ summary: Methods to write more compact and meaningful, auto-documented specs for web
298
+ APIs.
116
299
  test_files: []
@@ -1,11 +0,0 @@
1
- require 'rack/test'
2
- require 'rspec-api/http/local/route'
3
- require 'rspec-api/http/local/request'
4
-
5
- def app
6
- Rails.application
7
- end
8
-
9
- RSpec.configuration.include Rack::Test::Methods, rspec_api_dsl: :route
10
- RSpec.configuration.include Http::Local::Route, rspec_api_dsl: :route
11
- RSpec.configuration.include Http::Local::Request, rspec_api_dsl: :request