Hello, I''m trying to figure out how to setup a spec structure for plugins. I''m getting pretty lost in figuring out how to isolate a plugin enviornment emulating rails, but not actually being reflected upon the current rails project. What I mean is this, let''s say I have a comment plugin. This has two things in lib, the comment model (comment.rb) and then the module ruby file for methods. I''m trying to figure out how I would spec this out in the actual plugin directory (vendor/plugins/comment_plugin/spec). What would my spec_helper look like? How would I spec that it works? Why I''m saying this is because I can''t use any of the /app/models/ in the rails project because that is specific to a rails project, I''m trying to isolate it into the plugin. How would I fake a model in rspec, especially with the line that "acts_as_comment" which sets up the polymorphic association. If anyone has any advice, or knows of any plugins that are tested with rspec and not rails testing, let me know. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070803/09f9e2af/attachment-0001.html
Fischer, Daniel wrote:> Hello, > > I''m trying to figure out how to setup a spec structure for plugins. I''m > getting pretty lost in figuring out how to isolate a plugin enviornment > emulating rails, but not actually being reflected upon the current rails > project.I just saw an article yesterday about this very topic, though of course it''s Test::Unit-focused, not rspec: http://www.pluginaweek.org/2006/11/24/plugin-tip-of-the-week-testing-your-plugins-the-right-way/
On 8/3/07, Fischer, Daniel <daniel at danielfischer.com> wrote:> Hello, > > I''m trying to figure out how to setup a spec structure for plugins. I''m > getting pretty lost in figuring out how to isolate a plugin enviornment > emulating rails, but not actually being reflected upon the current rails > project. > > What I mean is this, let''s say I have a comment plugin. This has two things > in lib, the comment model (comment.rb) and then the module ruby file for > methods. > > I''m trying to figure out how I would spec this out in the actual plugin > directory (vendor/plugins/comment_plugin/spec). What would > my spec_helper look like? How would I spec that it works? Why I''m saying > this is because I can''t use any of the /app/models/ in the rails project > because that is specific to a rails project, I''m trying to isolate it into > the plugin. How would I fake a model in rspec, especially with the line > that "acts_as_comment" which sets up the polymorphic association. If anyone > has any advice, or knows of any plugins that are tested with rspec and not > rails testing, let me know. > > > Thanks. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Hey Daniel, You might be interested in the rspec_plugin generator. http://agilewebdevelopment.com/plugins/rspec_plugin Pat
Reasonably Related Threads
- Could anyone please help with rspec/nested resource behavior checking?
- Testing Plugins + Lib Code
- Can''t seem to spec a ActiveRecord::RecordInvalid exception properly...
- Annoying problem, stack error
- Integrating polymorphic models into controllers views? how?