Sha256: f054ec43488321ebe90baae1366f359f0b69b3d8664bcdf1e370b86e649b04b0

Contents?: true

Size: 604 Bytes

Versions: 2

Compression:

Stored size: 604 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe CouchPotato::View::ModelViewSpec, 'map_function' do
  it "should include conditions" do
    spec = CouchPotato::View::ModelViewSpec.new Object, 'all', {:conditions => 'doc.closed = true'}, {}
    spec.map_function.should include('if(doc.ruby_class && doc.ruby_class == \'Object\' && (doc.closed = true))')
  end
  
  it "should not include conditions when they are nil" do
    spec = CouchPotato::View::ModelViewSpec.new Object, 'all', {}, {}
    spec.map_function.should include('if(doc.ruby_class && doc.ruby_class == \'Object\')')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couch_potato-0.2.20 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.19 spec/unit/model_view_spec_spec.rb