Sha256: da556dfb267055c90839fd6d84e8b9810ef1d2215740ae57910f9eefe5acf76c

Contents?: true

Size: 576 Bytes

Versions: 23

Compression:

Stored size: 576 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.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

23 entries across 23 versions & 2 rubygems

Version Path
couch_potato-0.6.0 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.7 spec/unit/model_view_spec_spec.rb
couch_potato-rails2-0.5.10 spec/unit/model_view_spec_spec.rb
couch_potato-rails2-0.5.9 spec/unit/model_view_spec_spec.rb
couch_potato-rails2-0.5.8 spec/unit/model_view_spec_spec.rb
couch_potato-rails2-0.5.7 spec/unit/model_view_spec_spec.rb
couch_potato-rails2-0.5.6 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.6 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.5 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.4 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.3 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.2 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.1 spec/unit/model_view_spec_spec.rb
couch_potato-0.5.0 spec/unit/model_view_spec_spec.rb
couch_potato-0.4.0 spec/unit/model_view_spec_spec.rb
couch_potato-0.3.2 spec/unit/model_view_spec_spec.rb
couch_potato-0.3.1 spec/unit/model_view_spec_spec.rb
couch_potato-0.3.0 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.32 spec/unit/model_view_spec_spec.rb
couch_potato-0.2.31 spec/unit/model_view_spec_spec.rb