Check out https://github.com/schneems/wicked all of the tests are integration tests with capybara. If something is going to break it is going to break in a way the user would see it. You can see a variety of mixed unit/controller/integration tests in my OAuth provider gem https://github.com/opro/opro.
You get a dummy Rails app for free when you initialize a new project using https://github.com/josevalim/enginex, I haven't tried with `rails plugin new` but I would expect you get something similar. This article should have some info on testing for you: http://coding.smashingmagazine.com/2011/06/23/a-guide-to-starting-your-own-rails-engine-gem/ but it is a bit dated. -- Richard Schneeman http://heroku.com @schneems (http://twitter.com/schneems) On Wednesday, September 26, 2012 at 8:12 PM, Jeffrey Jones wrote: > Hello Richard. > > That makes sense, and it is the route I am looking at, but how does one boot > the dummy app and access it using (for example) capybara? > > Most information and repositories I have seen online do unit testing against > the dummy app; I have not found any information on how to do full integration > tests against the dummy app. > > I am suer I must be missing something obvious or have managed to miss an > obvious example repository to look at but I am not sure what (Hence the > missing it in the first place) > > cheer > > Jeff > > > On 27/09/12 01:50, Richard Schneeman wrote: > > When I have problems isolating behavior in tests, sometimes it can be > > useful to test more rather than less. If you are testing log output, use a > > dummy rails app inside of your test suite with dummy controller actions and > > hit it as a user would with capybara. Then you could route logs to stdout > > or a custom log object, or simply parse the log file in log/ to verify the > > correct strings are being written. While not as helpful for development as > > unit tests, this type of end-to-end testing is great for protecting against > > regressions and bugs. > > > > -- > > Richard Schneeman > > http://heroku.com > > > > @schneems (http://twitter.com/schneems) > > > > > > > > > > On Wednesday, September 26, 2012 at 5:05 AM, Jeffrey Jones wrote: > > > > > Ahoi Gary > > > > > > Thanks for the info but the gem has already been created and the testing > > > I want to do is not obvious (to my mind anyway) so online "Getting > > > started" style stuff that I have found is not that useful.. > > > > > > This is why I was asking if an expert can offer some time to answer > > > specific questions I have and help my get my head around it. > > > > > > On a site-note by hacking around I seem to have got the LogSubscriber > > > tests working, still no idea on how to do the rack logger tests though. > > > > > > Cheers > > > > > > Jeff > > > > > > > > > On 25/09/12 23:58, Gary Weaver wrote: > > > > Not an expert, but since I have been kind of slack on testing recently, > > > > I'll try to get some karma by trying to help. First, you may want to > > > > ask on this list instead/too: > > > > https://groups.google.com/forum/?fromgroups=#!forum/rubyonrails-talk > > > > (https://groups.google.com/forum/?fromgroups=#%21forum/rubyonrails-talk) > > > > (Stackoverflow is also a good place to get Rails stuff answered for > > > > more specific questions.) > > > > > > > > This was the thing for Rails 3.0: > > > > https://github.com/josevalim/enginex > > > > > > > > After that it became: > > > > rails plugin new > > > > > > > > In: http://guides.rubyonrails.org/plugins.html > > > > > > > > > 1.2 Or generate a gemified plugin. > > > > > > > > > > Writing your Rails plugin as a gem, rather than as a vendored plugin, > > > > > lets you share your plugin across different rails applications using > > > > > RubyGems and Bundler. > > > > > > > > > > Rails 3.1 ships with a rails plugin new command which creates a > > > > > skeleton for developing any kind of Rails extension with the ability > > > > > to run integration tests using a dummy Rails application. See usage > > > > > and options by asking for help: > > > > > $ rails plugin --help > > > > > > > > This looks like it might help: > > > > http://namick.tumblr.com/post/17663752365/how-to-create-a-gemified-plugin-with-rails-3-2-rspec > > > > > > > > Rails initialization guide since you mentioned wanting to know the boot > > > > process, but sounds like you don't need it: > > > > http://guides.rubyonrails.org/initialization.html > > > > > > > > > > > > On Tuesday, September 25, 2012 1:00:38 AM UTC-4, Jeffrey Jones wrote: > > > > > Hello all. > > > > > > > > > > #1 I am working on a rails3 gem called Yarder > > > > > (https://github.com/rurounijones/yarder). The goal of this gem is to > > > > > replace the rails logging system with one that is JSON based rather > > > > > than > > > > > string based. > > > > > > > > > > #2 To this end I also recently asked this list about making the > > > > > LogSubscribers subscriptions to ActiveRecord::Notifications > > > > > configurable > > > > > and am looking at submitting a patch request. > > > > > > > > > > However for both of these I have rather run into a brick wall. > > > > > > > > > > #1 Yarder works (mostly, I have not finished or refactored and there > > > > > are > > > > > probably bugs) but it has no tests. The reasons for this is that I > > > > > cannot get my head around how to test it (and how to set up the tests > > > > > in > > > > > the first place ) and there aren't examples of this kind of stuff > > > > > online > > > > > that I can see (rails own LogSubscriber tests use a lot of support > > > > > files > > > > > specific to the rails gems which makes using them as a base less than > > > > > obvious) > > > > > > > > > > #2 For this I am just not exactly sure how to start (Both dev and > > > > > test) > > > > > > > > > > I have spent the last week or so looking through the rails code-base > > > > > and > > > > > testing setup to try and grok how to do the above but it is beyond me > > > > > at > > > > > the moment. > > > > > > > > > > I don't suppose there is a altruistic rails expert out there who is > > > > > willing to spare some time (email, skype, whatever suits you best) to > > > > > help me get my head around the rails internals (mainly the boot > > > > > process > > > > > and what to change for #2 plus setting up the tests) and how to test > > > > > #1. > > > > > > > > > > Regards, > > > > > > > > > > Jeff Jones > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Ruby on Rails: Core" group. > > > > To view this discussion on the web visit > > > > https://groups.google.com/d/msg/rubyonrails-core/-/a9Xaa3XtugcJ. > > > > To post to this group, send email to [email protected] > > > > (mailto:[email protected]). > > > > To unsubscribe from this group, send email to > > > > [email protected] > > > > (mailto:[email protected]). > > > > For more options, visit this group at > > > > http://groups.google.com/group/rubyonrails-core?hl=en. > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Ruby on Rails: Core" group. > > > To post to this group, send email to [email protected] > > > (mailto:[email protected]). > > > To unsubscribe from this group, send email to > > > [email protected] > > > (mailto:[email protected]). > > > For more options, visit this group at > > > http://groups.google.com/group/rubyonrails-core?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Core" group. > > To post to this group, send email to [email protected] > > (mailto:[email protected]). > > To unsubscribe from this group, send email to > > [email protected] > > (mailto:[email protected]). > > For more options, visit this group at > > http://groups.google.com/group/rubyonrails-core?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
