[rspec-users] Rspec on rails with out database?

barsalou barjunk at attglobal.net
Fri Jul 27 20:58:07 EDT 2007


Quoting David Chelimsky <dchelimsky at gmail.com>:

> On 7/27/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>> On 7/27/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>> > On 7/24/07, Eric Pugh <epugh at opensourceconnections.com> wrote:
>> > > Hi all,
>> > >
>> > > I am trying to use rspec_on_rails in a Rails app that doesn't have a
>> > > database.  so far I have just been faking it out by dumping in a
>> > > sqlite3 database just to make Rails happy.
>> >
>> > Try deleting config/database.yml (or renaming it to something else)
>> > and then running:
>> >
>> > rake spec
>> >
>> > That should do it.
>>
>> I take it back. It doesn't work. There is an open RFE on making this
>> work - perhaps it's time to address it.
>>
>
> Ah - this worked using Rails 1.2.3 and RSpec's trunk. In 
> config/environments.rb:
>
> Rails::Initializer.run do |config|
>  config.frameworks -= [ :active_record ]
> end
David,

I like this solution too, but then you don't have access to some of the 
other nicities for a model, like validations.

I found these links: 
http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects
http://wiki.rubyonrails.com/rails/pages/HowToUseValidationsWithoutExtendingActiveRecord
http://www.railsweenie.com/forums/2/topics/724

That talk about different ways to solve this.  The last link seems like 
the best.




>
> Cheers,
> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the rspec-users mailing list