简体   繁体   中英

Calabash Android - undefined method `keys' for nil:NilClass (NoMethodError)

I need your help to figure out a solution to an error I'm facing

I'm creating tests for my app with calabash and here is my code :

url = 'myUrl'
http = Net::HTTP.new(url, 80)

path = '/login/login.php'

resp, data = http.get(path, nil)   <-- This line fires the error
cookie = resp.response['set-cookie']

Here is what I get :

undefined method `keys' for nil:NilClass (NoMethodError)
./features/step_definitions/calabash_steps.rb:33

I don't understand what it refers to ? How can I solve it ? knowing that the line 33 is the one I displayed in the first code snippet.

I think I am calling keys on some undefined variable or empty one but can't figure out which, that's a simple code.

I welcome any idea ! Thank you =)

只需删除nil参数:

resp, data = http.get(path)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM