Hi, I''m having trouble writing tests for a plugin I''m working on. In my plugin directory, I have /lib/my_plugin.rb : ===== require ''extensions'' # in [plugin]/lib class NewClass < ActiveForm # ActiveForm defined in a different plugin end ===== My [plugin]/test/my_test.rb has the following ===== require ''test/unit'' require File.dirname(__FILE__) + ''/../lib/my_plugin'' ===== However, I get ===== "in `gem_original_require'': no such file to load -- extensions (LoadError)" ===== and, if I remove the call to require ''extensions'' ===== uninitialized constant ActiveForm (NameError) ===== How can I write my tests/structure my plugin to avoid these errors? As an aside, is there any documentation on what the load path is at any given time? I mean something saying "[these] directories are available when [...]" rather than me having to try ''puts''ing a variable at different points in my application to learn through trial and error Thanks, Gareth --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Gareth Adams
2006-Oct-05 09:13 UTC
Other load path questions [Was: Tests for plugins - "require"d files]
This is the situation: [plugin]/lib/my_module.rb =====require ''validations'' module MyModule module Transaction class Request # All of these give a NameError # include Validations # include parent.Validations # include MyModule::Transaction::Validations [...] end end end ===== [plugin]/lib/validations.rb =====require ''validations'' module MyModule module Transaction module Validations [...] end end end ===== [plugin]/init.rb =====require ''validations'' require ''my_module'' # Also gives the same NameError: # # VSPDirect::Transaction::Request.module_eval do # include Validations # end ===== The question is, what is the best way of doing what I''m trying to do? I hope it''s obvious, but if it''s not then ask for clarification --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---