couchdb 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,8 +46,9 @@ module CouchDB
46
46
  end
47
47
 
48
48
  def [](name)
49
+ name = name.to_s
49
50
  map, reduce = @design["views"][name].values_at("map", "reduce")
50
- Design::View.new name, map, reduce
51
+ Design::View.new @design, name, map, reduce
51
52
  end
52
53
 
53
54
  end
@@ -19,6 +19,17 @@ describe "views" do
19
19
  @design.save
20
20
  end
21
21
 
22
+ describe "selecting a view by it's name" do
23
+
24
+ it "should return the right view" do
25
+ view = @design.views[:view_1]
26
+ view.should be_instance_of(CouchDB::Design::View)
27
+ view.map.should == @view.map
28
+ view.reduce.should == @view.reduce
29
+ end
30
+
31
+ end
32
+
22
33
  describe "collection" do
23
34
 
24
35
  it "should return a collection including the right rows" do
@@ -84,12 +84,12 @@ describe CouchDB::Design do
84
84
  end
85
85
 
86
86
  it "should initialize a new view" do
87
- CouchDB::Design::View.should_receive(:new).with("test_view", "test_map", "test_reduce").and_return(@view)
88
- @design.views["test_view"]
87
+ CouchDB::Design::View.should_receive(:new).with(@design, "test_view", "test_map", "test_reduce").and_return(@view)
88
+ @design.views[:test_view]
89
89
  end
90
90
 
91
91
  it "should return the new view" do
92
- @design.views["test_view"].should == @view
92
+ @design.views[:test_view].should == @view
93
93
  end
94
94
 
95
95
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Philipp Br\xC3\xBCll"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-07 00:00:00 +01:00
17
+ date: 2010-12-13 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency