Sha256: 649b308bc00853a998d282e26b2ced3a8482ae83f3262dcd57052c4e8e39bfa4

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

require '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.#{CouchPotato.type_field} && doc.#{CouchPotato.type_field} == '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.#{CouchPotato.type_field} && doc.#{CouchPotato.type_field} == 'Object')")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
davber_couch_potato-0.4.0 spec/unit/model_view_spec_spec.rb
davber_couch_potato-0.3.0 spec/unit/model_view_spec_spec.rb