Sha256: d1fa2841289975e0b31df7d894b907dec862dd6c6f6ae6b26208227525a18ba2

Contents?: true

Size: 605 Bytes

Versions: 7

Compression:

Stored size: 605 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

7 entries across 7 versions & 1 rubygems

Version Path
couch_potato-0.2.27 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.26 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.25 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.24 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.23 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.22 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.21 spec/unit/model_view_spec_spec.rb