Hi, I am using Rails to develop an application where I do not use a database at all, so I have not defined a model at all, just controllers and views. The application runs fine, but when I try to run functional tests, it tries to connect to the database and fails without running any of my tests. How do I tell Rails to please not bother with databases during the tests? Thanks, Arun --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 29 Apr 2008, at 05:27, arunmehta wrote:> > Hi, I am using Rails to develop an application where I do not use a > database at all, so I have not defined a model at all, just > controllers and views. The application runs fine, but when I try to > run functional tests, it tries to connect to the database and fails > without running any of my tests. > > How do I tell Rails to please not bother with databases during the > tests?Don''t load the activerecord framework (There''s a thing in environment.rb for controlling which frameworks are loaded). I can''t remember if you still need to comment out the require of fixtures in test_help.rb Fred --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve seen some tests [such as those for the squirrel plugin] that just create their own ''test database'' on the fly On Mon, Apr 28, 2008 at 10:27 PM, arunmehta <arun.mehta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, I am using Rails to develop an application where I do not use a > database at all, so I have not defined a model at all, just > controllers and views. The application runs fine, but when I try to > run functional tests, it tries to connect to the database and fails > without running any of my tests. > > How do I tell Rails to please not bother with databases during the > tests? > > Thanks, > Arun > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
arunmehta wrote:> Hi, I am using Rails to develop an application where I do not use a > database at all, so I have not defined a model at all, just > controllers and views. The application runs fine, but when I try to > run functional tests, it tries to connect to the database and fails > without running any of my tests. > > How do I tell Rails to please not bother with databases during the > tests?Open config/database.yml and configure all the environments to use sqlite3 (or possibly less!). --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Apr 29, 2008 at 12:27 AM, arunmehta <arun.mehta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, I am using Rails to develop an application where I do not use a > database at all, so I have not defined a model at all, just > controllers and views. The application runs fine, but when I try to > run functional tests, it tries to connect to the database and fails > without running any of my tests. > > How do I tell Rails to please not bother with databases during the > tests?The database stuff gets pulled in by the file railties/lib/test_help.rb which is included by test/test_helper.rb The trick is to NOT include the test_help file, but instead copy the lines there which don''t require active record or fixtures. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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?hl=en -~----------~----~----~----~------~----~------~--~---
I have no personal experience with it, but your application sounds like a great candidate for Merb (http://merbivore.com/). If you don''t need ActiveRecord or a database, why have all that stuff included in your framework? Aren''t you just wasting memory? Don''t misunderstand. I think Rails is great, but it really is designed for database-backed applications and sort of assumes you have one. On Apr 29, 8:12 pm, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Apr 29, 2008 at 12:27 AM, arunmehta <arun.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, I am using Rails to develop an application where I do not use a > > database at all, so I have not defined a model at all, just > > controllers and views. The application runs fine, but when I try to > > run functional tests, it tries to connect to the database and fails > > without running any of my tests. > > > How do I tell Rails to please not bother with databases during the > > tests? > > The database stuff gets pulled in by the file > railties/lib/test_help.rb which is included by test/test_helper.rb > > The trick is to NOT include the test_help file, but instead copy the > lines there which don''t require active record or fixtures. > > -- > Rick DeNatale > > My blog on Rubyhttp://talklikeaduck.denhaven2.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Many thanks to all the kind folk for their help. I am not opposed to the use of databases, but for my application, i find it far more convenient to use session[:whatever]. Instead of messing with the standard code that rails generates, would it not be simpler to use a database instead of session, so that I can use the standard testing processes of Rails? Is there some way of doing this without the loss of convenience that the session hash provides? Great question, Robert, about why use Rails at all. Here is an incomplete set of reasons: 1. I teach computing, and need to very easily be able to get others to start using what I am. While Rails books are available at any decent book store in New Delhi, the Merb website http://merbivore.com/ says that Tutorials will be coming soon... 2. I love the structure Rails imposes on students who are learning programming basics by working on my project. 3. Ruby on Rails looks great on a resume. Very important consideration for my students. I would be delighted to hear of alternatives that beat Ruby on these considerations, while still allowing me to program in Ruby, on which point, I am afraid, there can be no compromise :-) Warmly, Arun On Apr 30, 5:26 am, Robert Walker <r0b3rt4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have no personal experience with it, but your application sounds > like a great candidate for Merb (http://merbivore.com/). If you don''t > need ActiveRecord or a database, why have all that stuff included in > your framework? Aren''t you just wasting memory? > > Don''t misunderstand. I think Rails is great, but it really is designed > for database-backed applications and sort of assumes you have one. > > On Apr 29, 8:12 pm, "Rick DeNatale" <rick.denat...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Tue, Apr 29, 2008 at 12:27 AM, arunmehta <arun.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, I am using Rails to develop an application where I do not use a > > > database at all, so I have not defined a model at all, just > > > controllers and views. The application runs fine, but when I try to > > > run functional tests, it tries to connect to the database and fails > > > without running any of my tests. > > > > How do I tell Rails to please not bother with databases during the > > > tests? > > > The database stuff gets pulled in by the file > > railties/lib/test_help.rb which is included by test/test_helper.rb > > > The trick is to NOT include the test_help file, but instead copy the > > lines there which don''t require active record or fixtures. > > > -- > > Rick DeNatale > > > My blog on Rubyhttp://talklikeaduck.denhaven2.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?hl=en -~----------~----~----~----~------~----~------~--~---