Skip to content

Instantly share code, notes, and snippets.

@croaky
Created January 18, 2011 03:46
Show Gist options
  • Save croaky/783948 to your computer and use it in GitHub Desktop.
Save croaky/783948 to your computer and use it in GitHub Desktop.
Getting a CouchDB app running on Rails 3 as of September, 2010
COUCH_CONNECTION = CouchRest.new
COUCH_CONNECTION.default_database = 'cloud_services'
COUCH_DB = COUCH_CONNECTION.default_database
Before do
db = CouchRest::Database.new(COUCH_CONNECTION, 'cloud_services_test')
db.create!
end
After do |scenario|
db = CouchRest::Database.new(COUCH_CONNECTION, 'cloud_services_test')
db.delete!
end
gem 'couchrest_extended_document'
class Service < CouchRest::ExtendedDocument
use_database COUCH_DB
property :name
property :category_name
property :purpose
property :rating, Integer
def self.recommended_by_category
[]
end
end
RSpec.configure do |config|
config.before(:each) do
db = CouchRest::Database.new(COUCH_CONNECTION, 'cloud_services_test')
db.create!
end
config.after(:each) do
db = CouchRest::Database.new(COUCH_CONNECTION, 'cloud_services_test')
db.delete!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment