Search code examples
phpandroidruby-on-railscalabash

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 =)


Solution

  • Just remove nil argument:

    resp, data = http.get(path)