spec/spec_helper.rb in langalex-couch_potato-0.1.1 vs spec/spec_helper.rb in langalex-couch_potato-0.2.0
- old
+ new
@@ -1,32 +1,30 @@
require 'rubygems'
-gem 'rspec'
require 'spec'
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'couch_potato'
CouchPotato::Config.database_name = 'couch_potato_test'
-CouchPotato::Persistence.Db.delete! rescue nil
-CouchPotato::Persistence.Db!
-class User
- include CouchPotato::Persistence
-
- has_many :comments, :stored => :inline
-end
-class Commenter
- include CouchPotato::Persistence
-
- has_many :comments, :stored => :separately
-end
-
class Comment
include CouchPotato::Persistence
validates_presence_of :title
property :title
belongs_to :commenter
+end
+
+def recreate_db
+ CouchPotato.couchrest_database.delete! rescue nil
+ CouchPotato.couchrest_database.server.create_db CouchPotato::Config.database_name
+end
+recreate_db
+
+Spec::Matchers.define :string_matching do |regex|
+ match do |string|
+ string =~ regex
+ end
end