Jonathan Telfer wrote:> I''m currently writing my first plugin, which is in the acts_as
style,
> but I can''t for the life of me work out how to get the testing
working.
>
> The plugin is called ''acts_as_task_list'', and I want to
create a model
> just for testing this, so my test currently looks like this:
>
> require ''test/unit''
> require ''active_record''
>
> # This model is just for testing the plugin.
> class Contract < ActiveRecord::Base
> acts_as_task_list
> end
>
> # The first bit doesn''t work, so I haven''t got as far
> # as this bit yet.
> class ActsAsTaskListTest < Test::Unit::TestCase
> # Replace this with your real tests.
> def test_this_plugin
> flunk
> end
> end
>
> As I expected, this test explodes because Ruby hasn''t loaded up
the
> plugin and included the acts_as_task_list into ActiveRecord::Base, but I
> don''t seem to be able to find out how to make this happen.
I''ve tried
> requiring the init.rb file for the plugin, but Ruby complains that it
> can''t find the source file.
>
> Although there''s plenty of help from Google, here and the Wiki on
> writing a plugin, I can''t find a single piece of information to
tell me
> what I''m doing wrong in the testing. If anyone can help it would
be much
> appreciated.
>
> Many thanks.
I answered my own question by looking at the testing in the
acts_as_classifiable plugin, inderting these two require lines at line 3
of the code lets this code run:
require File.join(File.dirname(__FILE__),
''../lib/acts_as_task_list'')
require File.join(File.dirname(__FILE__), ''../init'')
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---