undefined local variable or method `start_test_server_in_background' for main:Object

好久不见. 提交于 2019-12-12 14:36:08

问题


I try develop automatic test on Android device. I use Calabash and Ruby on Rails, version 2.1.2

I execute command:

calabash-android console aplikacja.apk -p tablet

After this I execute command in console:

/home/maciek/.rvm/gems/ruby-2.1.2/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /home/maciek/.rvm/gems/ruby-2.1.2 in PATH, mode 040777
/home/maciek/.rvm/gems/ruby-2.1.2/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /home/maciek/.rvm/gems/ruby-2.1.2 in PATH, mode 040777
2.1.2 :001 >start_test_server_in_background

After this I get error:

NameError: undefined local variable or method `start_test_server_in_background' for main:Object
    from (irb):1
    from /home/maciek/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'

I use real device - Samsung Galaxy Tab 2 7" with Android 4.1.1

What is wrong?


回答1:


First thing to try — execute unset IRBRC in console and only after launch Calabash.

Second one is to use Ruby version below 2.0 — e.g. 1.9.3.

There are several issues when running with Ruby 2.0. Few proofs:

  • https://github.com/calabash/calabash-android/issues/342
  • Install Calabash-Android causes error on OS X Mavericks

I've seen the same behavior myself, version downgrade/upgrade helps. But it looks like it relates to calabash-android only.




回答2:


This is because rvm set IRBRC variable to ruby console . it works if you unset the IRBRC value before opening calabash-console

Please do the following steps :

$unset IRBRC

$calabash-android console aplikacja.apk -p tablet

$start_test_server_in_background

post your comment below




回答3:


I suspect the problem is this:

https://github.com/calabash/calabash-android/pull/383

I think you can do this to work around this problem.

$ IRBRC= calabash-android console aplikacja.apk -p tablet



来源:https://stackoverflow.com/questions/24250022/undefined-local-variable-or-method-start-test-server-in-background-for-mainob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!