All My Junk -- In One Place

GitHub | YouTube | Twitter | Flickr | Coderwall | Keybase

Dec 24

Gettings Rails3, CouchDB, and RSpec to Play Nice

Spent the better part of 3 hours trying to get this to finally work.  I’m using:

gem ‘couchrest’
gem ‘couchrest_model’
gem ‘rspec-rails’
gem ‘rspec’

Simply running the regular bundle exec spec spec would always throw the error:

database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)

This seemed simple enough to me…ActiveRecord is still being called somewhere even though I’m trying to use CouchRest and CouchRest_Model.

First things first, you need to get ActiveRecord out of your Rails app. Hit up config/application.rb and comment out

require ‘rails/all’

and add the following:

require “action_controller/railtie”
require “action_mailer/railtie”
require “active_resource/railtie”
require “active_model/railtie”
require “rails/test_unit/railtie”

With that done, running spec will get you a different error, undefined method `fixture_path=’ for # (NoMethodError). Fix #2: Open up spec/spec_helper.rb and comment out the lines:

config.use_transactional_fixtures = true
config.fixture_path = “#{::Rails.root}/spec/fixtures”

Run rspec and watch those reds and greens go!

  1. benwoodall posted this