public
Rubygem
Fork of sam/dm-more
Description: Extras for DataMapper, including bridges to DataObjects::Migrations and Merb::DataMapper
Homepage: http://datamapper.org
Clone URL: git://github.com/dysinger/dm-more.git
Search Repo:
Adding in the view spec
Wed Apr 30 09:41:21 -0700 2008
commit  6c703ef44f6581f7b934724195c6d12068d519ee
tree    a1eb432efc35799916d516e5e79cc2e21fe8317c
parent  637f80f3a3cbf1a265e4aea723982943403d544c
...
38
39
40
 
 
 
 
 
 
 
 
 
 
41
42
43
...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
0
@@ -38,6 +38,16 @@
0
 end
0
 
0
 module DataMapper
0
+ module Adapters
0
+ class AbstractAdapter
0
+ def view(repository, resource, proc_name)
0
+ raise NotImplementedError
0
+ end
0
+ end
0
+ end
0
+end
0
+
0
+module DataMapper
0
   class View
0
     
0
     attr_reader :model, :name
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
0
@@ -1 +1,45 @@
0
+require 'pathname'
0
+require Pathname(__FILE__).dirname.parent.expand_path + 'lib/couchdb_adapter'
0
+
0
+describe "DataMapper::View" do
0
+ before(:all) do
0
+ class Zoo
0
+ include DataMapper::Resource
0
+ property :id, Fixnum, :serial => true
0
+ property :name, String
0
+ property :open, TrueClass
0
+ end
0
+ end
0
+
0
+ it "should have a view method" do
0
+ Zoo.should respond_to(:view)
0
+ end
0
+
0
+ it "should store a view when called" do
0
+ Zoo.view :by_name
0
+ Zoo.views.keys.should include(:by_name)
0
+ end
0
+
0
+ it "should initialize a new Procedure instance" do
0
+ proc = Zoo.view :by_name_desc
0
+ proc.should be_an_instance_of(DataMapper::View)
0
+ end
0
+
0
+ it "should create a getter method" do
0
+ Zoo.view :open
0
+ Zoo.should respond_to(:open)
0
+ end
0
+end
0
+
0
+describe "DataMapper::Repository" do
0
+ it "should define a view method" do
0
+ repository(:default).should respond_to(:view)
0
+ end
0
+end
0
+
0
+describe "DataMapper::Adapters::AbstractAdapter" do
0
+ it "should have a view method" do
0
+ DataMapper::Adapters::AbstractAdapter.instance_methods.should include("view")
0
+ end
0
+end

Comments

    No one has commented yet.