Hey guys!

I realize this may be a question that it would be more proper to ask in a 
Ruby forum, but I thought I should ask it here first since you're all so 
helpful...

I created a module and a method that defines other methods, thus...

module TopMenuBar
  
  def menu(name, menu_id, link_id, target_class)   
    define_method(name) {
      @browser.link(:id=>menu_id).fire_event("onmouseover")
      @browser.link(:id=>link_id).click
      eval(target_class).new @browser
    }
  end

  menu("my_dashboard", "navigation_you_link", "subnavigation_home_link", 
"MyDashboard")
  menu("my_messages", "navigation_you_link", "subnavigation_messages_link", 
"MyMessages")
  ...

end

I then include that Module in the relevant Classes that I create.

When I run my test script, however, I get the error:

"in `<class:MyDashboard>': undefined method `menu' for MyDashboard:Class 
(NoMethodError)"

This confuses me because as you can see I've defined the "menu" method 
right next to where I'm calling it.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to