Created
January 18, 2011 03:46
-
-
Save croaky/783948 to your computer and use it in GitHub Desktop.
Getting a CouchDB app running on Rails 3 as of September, 2010
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COUCH_CONNECTION = CouchRest.new | |
COUCH_CONNECTION.default_database = 'cloud_services' | |
COUCH_DB = COUCH_CONNECTION.default_database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'couchrest_extended_document' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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