Working on getting tests to work for new design doc checkcodes
This commit is contained in:
parent
221e5a5470
commit
da93fda815
9 changed files with 15 additions and 109 deletions
|
@ -103,12 +103,6 @@ module CouchRest
|
|||
design_doc
|
||||
end
|
||||
|
||||
# Return true if the two views match
|
||||
def compare_views(orig, repl)
|
||||
return false if orig.nil? or repl.nil?
|
||||
(orig['map'].to_s.strip == repl['map'].to_s.strip) && (orig['reduce'].to_s.strip == repl['reduce'].to_s.strip)
|
||||
end
|
||||
|
||||
end # module ClassMethods
|
||||
|
||||
end
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
module CouchRest
|
||||
|
||||
class Database
|
||||
|
||||
alias :delete_orig! :delete!
|
||||
def delete!
|
||||
clear_model_fresh_cache
|
||||
delete_orig!
|
||||
end
|
||||
|
||||
# If the database is deleted, ensure that the design docs will be refreshed.
|
||||
def clear_model_fresh_cache
|
||||
::CouchRest::Model::Base.subclasses.each{|klass| klass.req_design_doc_refresh if klass.respond_to?(:req_design_doc_refresh)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -15,8 +15,8 @@ CouchRest::Design.class_eval do
|
|||
base.delete('_rev')
|
||||
result = nil
|
||||
flatten =
|
||||
lambda{|v|
|
||||
v.is_a?(Hash) ? v.flatten.map{|v| flatten.call(v)}.flatten : v
|
||||
lambda {|v|
|
||||
v.is_a?(Hash) ? v.flatten.map{|v| flatten.call(v)}.flatten : v.to_s
|
||||
}
|
||||
Digest::MD5.hexdigest(flatten.call(base).sort.join(''))
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ module CouchRest
|
|||
module Model
|
||||
module Views
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
||||
module ClassMethods
|
||||
# Define a CouchDB view. The name of the view will be the concatenation
|
||||
# of <tt>by</tt> and the keys joined by <tt>_and_</tt>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue