NoMethodError: undefined method `query' for MyClass:Class (invoking calabash methods from my class)

230 views
Skip to first unread message

rpark

unread,
May 10, 2013, 7:35:40 PM5/10/13
to calaba...@googlegroups.com
I have:
class Myclass
  def MyClass.dump
    puts query "view", :accessibilityLabel
  end
end

I load this into calabash-ios console window, and
> MyClass.dump

I get the following error.
irb(main):024:0> MyClass.dump
NoMethodError: undefined method `query' for MyClass:Class
from (irb):21:in `dump'
from (irb):24

I did:
class MyClass < Calabash::IBase

But got the same error.

When I do:
def dump
  puts query "view", :accessibilityLabel
end

> dump

This works just fine.

How do I make my class wired for calabash methods?

Thanks,
/rpark

Krukow

unread,
May 12, 2013, 3:29:32 PM5/12/13
to calaba...@googlegroups.com


On Saturday, May 11, 2013 1:35:40 AM UTC+2, rpark wrote:
[snip]

How do I make my class wired for calabash methods?

Thanks,
/rpark


This uses Ruby modules. Basically if you look at the source for IBase, you'll see:

class Calabash::IBase
  include Calabash::Cucumber::Operations
 
for the whole file see: 


This "mixes in" the Calabash methods into your class.

- Karl

rpark

unread,
May 18, 2013, 12:50:53 PM5/18/13
to calaba...@googlegroups.com
Thank you.
I will try that out.
/rpark

rpark

unread,
Jun 20, 2013, 10:43:24 AM6/20/13
to calaba...@googlegroups.com

require 'calabash-cucumber/ibase'


class MyClass < Calabash::IBase
##
end

Works like a charms.

Thanks,
/red
Reply all
Reply to author
Forward
0 new messages