capybara-json 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6cc1d5e05030520550b2147e66dab8ac5821f30
4
+ data.tar.gz: feeb023d5cf00b6572d07510b2905dddcd623fc4
5
+ SHA512:
6
+ metadata.gz: f3d07078bce6ca89a71b2bf4acced6a16db08e8256d586e93ea6620e929bc860c2c5b00f69399a458c1365b42d60fad6e5f8ba03402145c5db3b42535c9fdda4
7
+ data.tar.gz: e02fe79e9ebfbdf26b045b63626a4be369c1237b2e160fed5739c8a50c7d4db5ea3692d6ae7fde862a20ba41d5dfecaa082a8ddbecaf3e066d412d61da0e525b
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile*.lock
4
4
  pkg/*
5
+ .ruby-version
@@ -1,9 +1,9 @@
1
1
  rvm:
2
- # - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
5
- # - ruby-head
3
+ - 2.0.0
4
+ - 2.1.*
6
5
  gemfile:
7
6
  - Gemfile
7
+ - Gemfile.capybara.lt.2.1
8
8
  - Gemfile.capybara.lt.2.0
9
9
  - Gemfile.capybara.lt.1.0
@@ -1,3 +1,7 @@
1
+ ## 0.4.0
2
+
3
+ * PATCH method support (Thanks to @xforty)
4
+
1
5
  ## 0.3.0
2
6
  * Capybara 2.x support (Thanks to @sonots, @gkellogg)
3
7
 
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capybara-json.gemspec
4
+ gem 'capybara', '~> 2.0.0'
5
+ gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # capybara-json [![Build Status](https://secure.travis-ci.org/okitan/capybara-json.png?branch=master)](http://travis-ci.org/okitan/capybara-json) [![Dependency Status](https://gemnasium.com/okitan/capybara-json.png)](https://gemnasium.com/okitan/capybara-json)
2
2
 
3
- testing ruby: 1.9.2, 1.9.3; Capybara: 0.4.x, 1.1.x, 2.0.x
3
+ testing ruby: 1.9.2, 1.9.3, 2.0.0; Capybara: 0.4.x, 1.1.x, 2.0.x
4
4
 
5
5
  ## About capybara-json
6
6
 
@@ -17,22 +17,26 @@ include Capybara::Json
17
17
  Capybara.current_driver = :rack_test_json
18
18
  Capybara.app = MyRackApp
19
19
  post '/', { "this is" => "json" } # POST '/'
20
- json #=> parsed json response
21
- source #=> raw response body
20
+ json #=> parsed json response
21
+ raw_json #=> raw response body
22
+
22
23
  get '/errors/400'
23
24
  status_code #=> 400
24
25
  get! '/errors' #=> raise Capybara::Json::Error
25
- get '/errors', {}, { 'header' => '' } # request headers
26
- response_headers #=> response headers
26
+
27
+ get '/errors', {}, { 'header' => '' } # set request headers
28
+ response_headers #=> get response headers
27
29
 
28
30
  Capybara.current_driver = :httpclient_json
29
31
  Capybara.app_host = 'http://example.com'
30
32
  post '/', { "this is" => "json" } # POST 'http://example.com/'
31
- json #=> parsed json response
32
- source #=> raw response body
33
+ json #=> parsed json response
34
+ raw_json #=> raw response body
35
+
33
36
  get '/errors/400'
34
37
  status_code #=> 400
35
38
  get! '/errors' #=> raise Capybara::Json::Error
36
- get '/errors', {}, { 'header' => '' } # request headers
37
- response_headers #=> response headers
39
+
40
+ get '/errors', {}, { 'header' => '' } # set request headers
41
+ response_headers #=> get response headers
38
42
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -2,8 +2,8 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "capybara-json"
4
4
  s.version = File.read(File.expand_path('VERSION', File.dirname(__FILE__))).chomp
5
- s.authors = ["okitan"]
6
- s.email = ["okitakunio@gmail.com"]
5
+ s.authors = ["okitan", "sonots"]
6
+ s.email = ["okitakunio@gmail.com", "sonots@gmail.com"]
7
7
  s.homepage = "http://github.com/okitan/capybara-json"
8
8
  s.summary = %q{for testing json-api}
9
9
  s.description = %q{for testing json-api}
@@ -29,6 +29,6 @@ Gem::Specification.new do |s|
29
29
 
30
30
  # for debug
31
31
  s.add_development_dependency "pry"
32
+ s.add_development_dependency "pry-nav"
32
33
  s.add_development_dependency "tapp"
33
- s.add_development_dependency "pry-debugger"
34
34
  end
@@ -58,6 +58,12 @@ class Capybara::HTTPClientJson::Driver < Capybara::Json::Driver::Base
58
58
  process :post, url, json, headers, options[:follow_redirect]
59
59
  end
60
60
 
61
+ def patch(url, json, headers = {})
62
+ json = MultiJson.dump(json) unless json.is_a?(String)
63
+ headers['Content-Type'] = "application/json; charset=#{json.encoding.to_s.downcase}"
64
+ process :patch, url, json, headers, options[:follow_redirect]
65
+ end
66
+
61
67
  def put(url, json, headers = {})
62
68
  json = MultiJson.dump(json) unless json.is_a?(String)
63
69
  headers['Content-Type'] = "application/json; charset=#{json.encoding.to_s.downcase}"
@@ -76,7 +82,7 @@ class Capybara::HTTPClientJson::Driver < Capybara::Json::Driver::Base
76
82
  DEF
77
83
  end
78
84
 
79
- %w[ post put ].each do |method|
85
+ %w[ post put patch ].each do |method|
80
86
  class_eval %{
81
87
  def #{method}!(url, json, headers = {})
82
88
  handle_error { #{method}(url, json, headers) }
@@ -1,6 +1,6 @@
1
1
  module Capybara::Json::Driver
2
2
  class Base
3
- %w[ get post put delete get! post! put! delete!
3
+ %w[ get post put patch delete get! post! put! patch! delete!
4
4
  reset!
5
5
  current_url
6
6
  raw_json json source body response_headers status_code
@@ -13,7 +13,7 @@ module Capybara
13
13
  DEF
14
14
  end
15
15
 
16
- %w[ post post! put put! ].each do |method|
16
+ %w[ post post! put put! patch patch! ].each do |method|
17
17
  module_eval <<-DEF, __FILE__, __LINE__ + 1
18
18
  def #{method}(path, json, env = {})
19
19
  page.driver.#{method}(path, json, env)
@@ -10,7 +10,7 @@ module Capybara::RackTestJson
10
10
  @app, @options = app, options
11
11
  end
12
12
 
13
- %w[ get post put delete ].each do |method|
13
+ %w[ get post put patch delete ].each do |method|
14
14
  module_eval <<-DEF, __FILE__, __LINE__+1
15
15
  def #{method}(uri, params = {}, env = {}, &block)
16
16
  env = env.merge(:method => "#{method.upcase}", :params => params)
@@ -31,7 +31,7 @@ class Capybara::RackTestJson::Driver < Capybara::Json::Driver::Base
31
31
  end
32
32
  alias visit get
33
33
 
34
- %w[ post put ].each do |method|
34
+ %w[ post put patch ].each do |method|
35
35
  class_eval <<-DEF, __FILE__, __LINE__ + 1
36
36
  def #{method}(path, json, env = {})
37
37
  json = MultiJson.dump(json) unless json.is_a?(String)
@@ -69,7 +69,7 @@ shared_examples_for "driver with cookies support" do
69
69
  describe "#reset!" do
70
70
  it "should set and clean cookies" do
71
71
  @driver.visit('/get_cookie')
72
- @driver.body.should_not include('test_cookie')
72
+ @driver.raw_json.should_not include('test_cookie')
73
73
 
74
74
  @driver.visit('/set_cookie')
75
75
  @driver.body.should include('Cookie set to test_cookie')
@@ -79,7 +79,7 @@ shared_examples_for "driver with cookies support" do
79
79
 
80
80
  @driver.reset!
81
81
  @driver.visit('/get_cookie')
82
- @driver.body.should_not include('test_cookie')
82
+ @driver.raw_json.should_not include('test_cookie')
83
83
  end
84
84
  end
85
85
  end
metadata CHANGED
@@ -1,225 +1,203 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - okitan
8
+ - sonots
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-12 00:00:00.000000000 Z
12
+ date: 2015-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '0'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
27
  version: '0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: httpclient
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ~>
32
+ - - "~>"
36
33
  - !ruby/object:Gem::Version
37
34
  version: '2.2'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ~>
39
+ - - "~>"
44
40
  - !ruby/object:Gem::Version
45
41
  version: '2.2'
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: multi_json
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ~>
46
+ - - "~>"
52
47
  - !ruby/object:Gem::Version
53
48
  version: '1.3'
54
49
  type: :runtime
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ~>
53
+ - - "~>"
60
54
  - !ruby/object:Gem::Version
61
55
  version: '1.3'
62
56
  - !ruby/object:Gem::Dependency
63
57
  name: rake
64
58
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
59
  requirements:
67
- - - ! '>='
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
62
  version: '0'
70
63
  type: :development
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
- - - ! '>='
67
+ - - ">="
76
68
  - !ruby/object:Gem::Version
77
69
  version: '0'
78
70
  - !ruby/object:Gem::Dependency
79
71
  name: rspec
80
72
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
73
  requirements:
83
- - - ~>
74
+ - - "~>"
84
75
  - !ruby/object:Gem::Version
85
76
  version: '2.11'
86
77
  type: :development
87
78
  prerelease: false
88
79
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
80
  requirements:
91
- - - ~>
81
+ - - "~>"
92
82
  - !ruby/object:Gem::Version
93
83
  version: '2.11'
94
84
  - !ruby/object:Gem::Dependency
95
85
  name: sinatra
96
86
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
87
  requirements:
99
- - - ! '>='
88
+ - - ">="
100
89
  - !ruby/object:Gem::Version
101
90
  version: '0'
102
91
  type: :development
103
92
  prerelease: false
104
93
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
94
  requirements:
107
- - - ! '>='
95
+ - - ">="
108
96
  - !ruby/object:Gem::Version
109
97
  version: '0'
110
98
  - !ruby/object:Gem::Dependency
111
99
  name: thin
112
100
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
101
  requirements:
115
- - - ! '>='
102
+ - - ">="
116
103
  - !ruby/object:Gem::Version
117
104
  version: '0'
118
105
  type: :development
119
106
  prerelease: false
120
107
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
108
  requirements:
123
- - - ! '>='
109
+ - - ">="
124
110
  - !ruby/object:Gem::Version
125
111
  version: '0'
126
112
  - !ruby/object:Gem::Dependency
127
113
  name: yajl-ruby
128
114
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
115
  requirements:
131
- - - ! '>='
116
+ - - ">="
132
117
  - !ruby/object:Gem::Version
133
118
  version: '0'
134
119
  type: :development
135
120
  prerelease: false
136
121
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
122
  requirements:
139
- - - ! '>='
123
+ - - ">="
140
124
  - !ruby/object:Gem::Version
141
125
  version: '0'
142
126
  - !ruby/object:Gem::Dependency
143
127
  name: autowatchr
144
128
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
129
  requirements:
147
- - - ! '>='
130
+ - - ">="
148
131
  - !ruby/object:Gem::Version
149
132
  version: '0'
150
133
  type: :development
151
134
  prerelease: false
152
135
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
136
  requirements:
155
- - - ! '>='
137
+ - - ">="
156
138
  - !ruby/object:Gem::Version
157
139
  version: '0'
158
140
  - !ruby/object:Gem::Dependency
159
141
  name: pry
160
142
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
143
  requirements:
163
- - - ! '>='
144
+ - - ">="
164
145
  - !ruby/object:Gem::Version
165
146
  version: '0'
166
147
  type: :development
167
148
  prerelease: false
168
149
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
150
  requirements:
171
- - - ! '>='
151
+ - - ">="
172
152
  - !ruby/object:Gem::Version
173
153
  version: '0'
174
154
  - !ruby/object:Gem::Dependency
175
- name: tapp
155
+ name: pry-nav
176
156
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
157
  requirements:
179
- - - ! '>='
158
+ - - ">="
180
159
  - !ruby/object:Gem::Version
181
160
  version: '0'
182
161
  type: :development
183
162
  prerelease: false
184
163
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
164
  requirements:
187
- - - ! '>='
165
+ - - ">="
188
166
  - !ruby/object:Gem::Version
189
167
  version: '0'
190
168
  - !ruby/object:Gem::Dependency
191
- name: pry-debugger
169
+ name: tapp
192
170
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
171
  requirements:
195
- - - ! '>='
172
+ - - ">="
196
173
  - !ruby/object:Gem::Version
197
174
  version: '0'
198
175
  type: :development
199
176
  prerelease: false
200
177
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
178
  requirements:
203
- - - ! '>='
179
+ - - ">="
204
180
  - !ruby/object:Gem::Version
205
181
  version: '0'
206
182
  description: for testing json-api
207
183
  email:
208
184
  - okitakunio@gmail.com
185
+ - sonots@gmail.com
209
186
  executables: []
210
187
  extensions: []
211
188
  extra_rdoc_files: []
212
189
  files:
213
- - .gitignore
214
- - .pryrc
215
- - .rbenv-gemsets
216
- - .rvmrc
217
- - .rvmrc.capybara.lt.1.0
218
- - .travis.yml
190
+ - ".gitignore"
191
+ - ".pryrc"
192
+ - ".rbenv-gemsets"
193
+ - ".rvmrc"
194
+ - ".rvmrc.capybara.lt.1.0"
195
+ - ".travis.yml"
219
196
  - CHANGELOG.md
220
197
  - Gemfile
221
198
  - Gemfile.capybara.lt.1.0
222
199
  - Gemfile.capybara.lt.2.0
200
+ - Gemfile.capybara.lt.2.1
223
201
  - README.md
224
202
  - Rakefile
225
203
  - VERSION
@@ -244,27 +222,26 @@ files:
244
222
  - spec/support/json_test_app.rb
245
223
  homepage: http://github.com/okitan/capybara-json
246
224
  licenses: []
225
+ metadata: {}
247
226
  post_install_message:
248
227
  rdoc_options: []
249
228
  require_paths:
250
229
  - lib
251
230
  required_ruby_version: !ruby/object:Gem::Requirement
252
- none: false
253
231
  requirements:
254
- - - ! '>='
232
+ - - ">="
255
233
  - !ruby/object:Gem::Version
256
234
  version: '0'
257
235
  required_rubygems_version: !ruby/object:Gem::Requirement
258
- none: false
259
236
  requirements:
260
- - - ! '>='
237
+ - - ">="
261
238
  - !ruby/object:Gem::Version
262
239
  version: '0'
263
240
  requirements: []
264
241
  rubyforge_project: capybara-json
265
- rubygems_version: 1.8.24
242
+ rubygems_version: 2.2.2
266
243
  signing_key:
267
- specification_version: 3
244
+ specification_version: 4
268
245
  summary: for testing json-api
269
246
  test_files:
270
247
  - spec/capybara/httpclient_json/driver_spec.rb
@@ -277,4 +254,3 @@ test_files:
277
254
  - spec/support/driver_examples.rb
278
255
  - spec/support/dsl_examples.rb
279
256
  - spec/support/json_test_app.rb
280
- has_rdoc: