简体   繁体   English

设置Rails插件的测试目录

[英]Setup a testdirectory for a Rails Plugin

I started to create a rails plugin which includes some class and instance methods of Controller and Model. 我开始创建一个Rails插件,其中包括Controller和Model的一些类和实例方法。 I fist tried to setup the tests for the Model. 我首先尝试设置模型的测试。

Add a models directory in my test dir. 在我的测试目录中添加模型目录。 But i noticed - i need the geokit-rails plugin for my model to be able to "acts_as_mappable" 但我注意到-我的模型需要geokit-rails插件才能“ acts_as_mappable”

How to get the plugin into the test dir? 如何将插件插入测试目录? I tryied to copy it to /test/plugins/geokit-rails and include it in my test_helper? 我试图将其复制到/ test / plugins / geokit-rails并将其包含在我的test_helper中?

require 'geokit'
require PLUGIN_ROOT + '/test/plugins/geokit-rails/lib/geokit-rails.rb'

I get an error from the plugin 我从插件收到错误

MissingSourceFile: no such file to load — geokit-rails/defaults

any suggestions? 有什么建议么?

i got the plugin running with some changes in geokit-rails/lib/geokit-rails.rb 我在geokit-rails / lib / geokit-rails.rb中进行了一些更改使插件运行

dir = File.join(File.dirname(__FILE__))
require dir + '/geokit-rails/defaults'
require dir + '/geokit-rails/adapters/abstract'
require dir + '/geokit-rails/acts_as_mappable'
require dir + '/geokit-rails/ip_geocode_lookup'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM