lib/capybara/rack_test_json/driver.rb in capybara-json-0.2.3 vs lib/capybara/rack_test_json/driver.rb in capybara-json-0.2.4
- old
+ new
@@ -17,24 +17,24 @@
client.last_response
end
alias response last_response
%w[ get delete ].each do |method|
- class_eval %{
+ class_eval <<-DEF, __FILE__, __LINE__ + 1
def #{method}(path, params = {}, env = {})
client.#{method}(path, params, env_for_rack(env))
end
def #{method}!(path, params = {}, env = {})
handle_error { #{method}(path, params, env) }
end
- }
+ DEF
end
alias visit get
%w[ post put ].each do |method|
- class_eval %{
+ class_eval <<-DEF, __FILE__, __LINE__ + 1
def #{method}(path, json, env = {})
json = MultiJson.dump(json) unless json.is_a?(String)
request_env = {
'CONTENT_LENGTH' => json.size,
@@ -46,10 +46,10 @@
end
def #{method}!(path, json, env = {})
handle_error { #{method}(path, json, env) }
end
- }
+ DEF
end
def current_url
last_request.url
end