capybara-json 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/capybara/httpclient_json/driver.rb +2 -2
- data/lib/capybara/json.rb +12 -4
- data/lib/capybara/rack_test_json/client.rb +2 -2
- data/lib/capybara/rack_test_json/driver.rb +4 -4
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -67,11 +67,11 @@ class Capybara::HTTPClientJson::Driver < Capybara::Json::Driver::Base
|
|
67
67
|
end
|
68
68
|
|
69
69
|
%w[ get delete ].each do |method|
|
70
|
-
class_eval
|
70
|
+
class_eval <<-DEF, __FILE__, __LINE__ + 1
|
71
71
|
def #{method}!(url, params = {}, env = {})
|
72
72
|
handle_error { #{method}(url, params, env) }
|
73
73
|
end
|
74
|
-
|
74
|
+
DEF
|
75
75
|
end
|
76
76
|
|
77
77
|
%w[ post put ].each do |method|
|
data/lib/capybara/json.rb
CHANGED
@@ -15,19 +15,27 @@ module Capybara
|
|
15
15
|
end
|
16
16
|
|
17
17
|
%w[ get get! delete delete! ].each do |method|
|
18
|
-
module_eval
|
18
|
+
module_eval <<-DEF, __FILE__, __LINE__ + 1
|
19
19
|
def #{method}(path, params = {}, env = {})
|
20
20
|
page.driver.#{method}(path, params, env)
|
21
21
|
end
|
22
|
-
|
22
|
+
DEF
|
23
23
|
end
|
24
24
|
|
25
25
|
%w[ post post! put put! ].each do |method|
|
26
|
-
module_eval
|
26
|
+
module_eval <<-DEF, __FILE__, __LINE__ + 1
|
27
27
|
def #{method}(path, json, env = {})
|
28
28
|
page.driver.#{method}(path, json, env)
|
29
29
|
end
|
30
|
-
|
30
|
+
DEF
|
31
|
+
end
|
32
|
+
|
33
|
+
%w[ json ].each do |method|
|
34
|
+
module_eval <<-DEF, __FILE__, __LINE__ + 1
|
35
|
+
def #{method}
|
36
|
+
page.driver.#{method}
|
37
|
+
end
|
38
|
+
DEF
|
31
39
|
end
|
32
40
|
|
33
41
|
autoload :Error, 'capybara/json/error'
|
@@ -11,7 +11,7 @@ module Capybara::RackTestJson
|
|
11
11
|
end
|
12
12
|
|
13
13
|
%w[ get post put delete ].each do |method|
|
14
|
-
module_eval
|
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)
|
17
17
|
if options[:follow_redirect]
|
@@ -20,7 +20,7 @@ module Capybara::RackTestJson
|
|
20
20
|
request(uri, env)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
DEF
|
24
24
|
end
|
25
25
|
|
26
26
|
def request_with_follow_redirect(uri, env)
|
@@ -19,7 +19,7 @@ class Capybara::RackTestJson::Driver < Capybara::Json::Driver::Base
|
|
19
19
|
alias response last_response
|
20
20
|
|
21
21
|
%w[ get delete ].each do |method|
|
22
|
-
class_eval
|
22
|
+
class_eval <<-DEF, __FILE__, __LINE__ + 1
|
23
23
|
def #{method}(path, params = {}, env = {})
|
24
24
|
client.#{method}(path, params, env_for_rack(env))
|
25
25
|
end
|
@@ -27,12 +27,12 @@ class Capybara::RackTestJson::Driver < Capybara::Json::Driver::Base
|
|
27
27
|
def #{method}!(path, params = {}, env = {})
|
28
28
|
handle_error { #{method}(path, params, env) }
|
29
29
|
end
|
30
|
-
|
30
|
+
DEF
|
31
31
|
end
|
32
32
|
alias visit get
|
33
33
|
|
34
34
|
%w[ post put ].each do |method|
|
35
|
-
class_eval
|
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)
|
38
38
|
|
@@ -48,7 +48,7 @@ class Capybara::RackTestJson::Driver < Capybara::Json::Driver::Base
|
|
48
48
|
def #{method}!(path, json, env = {})
|
49
49
|
handle_error { #{method}(path, json, env) }
|
50
50
|
end
|
51
|
-
|
51
|
+
DEF
|
52
52
|
end
|
53
53
|
|
54
54
|
def current_url
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capybara
|