couchdb 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,9 @@ module CouchDB
47
47
 
48
48
  def [](name)
49
49
  name = name.to_s
50
- map, reduce = @design["views"][name].values_at("map", "reduce")
50
+ views = @design["views"]
51
+ return nil unless views.has_key?(name)
52
+ map, reduce = views[name].values_at("map", "reduce")
51
53
  Design::View.new @design, name, map, reduce
52
54
  end
53
55
 
@@ -92,6 +92,10 @@ describe CouchDB::Design do
92
92
  @design.views[:test_view].should == @view
93
93
  end
94
94
 
95
+ it "should return nil if view doesn't exists" do
96
+ @design.views[:invalid].should be_nil
97
+ end
98
+
95
99
  end
96
100
 
97
101
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
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-13 00:00:00 +01:00
17
+ date: 2010-12-16 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency