Sha256: 616f7513cdcb63b67a469cfac79f6ceb604d545232608acb4c84be7fc980e4d7
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require File.join(File.dirname(__FILE__), 'spec_helper.rb') class Viewable include DataMapper::Resource def self.default_repository_name :couch end property :name, String property :open, Boolean end describe DataMapper::Resource::View do it "should have a view method" do Viewable.should respond_to(:view) end it "should store a view when called" do Viewable.view :by_name Viewable.views.keys.should include(:by_name) end it "should initialize a new Procedure instance" do proc = Viewable.view :by_name_desc proc.should be_an_instance_of(DataMapper::Resource::View) end it "should create a getter method" do Viewable.view :open Viewable.should respond_to(:open) end describe "for inherited resources" do before(:all) do Person.auto_migrate! end it "should set the correct couchdb types" do Person.couchdb_types.include?(Person).should be_true Person.couchdb_types.include?(Employee).should be_true end it "should create views with the correct couchdb type conditions" do Person.views[:by_name].should == {"map"=>"function(doc) { if (doc.couchdb_type == 'Person' || doc.couchdb_type == 'Employee') { emit(doc.name, doc); } }"} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-couchdb-adapter-0.10.2 | spec/integration/couchdb_view_spec.rb |