samlown-couchrest_extended_document 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/history.txt
CHANGED
@@ -56,6 +56,7 @@ module CouchRest
|
|
56
56
|
nil
|
57
57
|
end
|
58
58
|
end
|
59
|
+
alias :find :get
|
59
60
|
|
60
61
|
# Load a document from the database by id
|
61
62
|
# An exception will be raised if the document isn't found
|
@@ -72,6 +73,7 @@ module CouchRest
|
|
72
73
|
doc = db.get id
|
73
74
|
create_from_database(doc)
|
74
75
|
end
|
76
|
+
alias :find! :get!
|
75
77
|
|
76
78
|
end
|
77
79
|
|
@@ -328,15 +328,20 @@ describe "ExtendedDocument" do
|
|
328
328
|
foundart = Article.get @art.id
|
329
329
|
foundart.title.should == "All About Getting"
|
330
330
|
end
|
331
|
-
|
331
|
+
it "should load and instantiate with find" do
|
332
|
+
foundart = Article.find @art.id
|
333
|
+
foundart.title.should == "All About Getting"
|
334
|
+
end
|
332
335
|
it "should return nil if `get` is used and the document doesn't exist" do
|
333
336
|
foundart = Article.get 'matt aimonetti'
|
334
337
|
foundart.should be_nil
|
335
338
|
end
|
336
|
-
|
337
339
|
it "should raise an error if `get!` is used and the document doesn't exist" do
|
338
340
|
lambda{foundart = Article.get!('matt aimonetti')}.should raise_error
|
339
341
|
end
|
342
|
+
it "should raise an error if `find!` is used and the document doesn't exist" do
|
343
|
+
lambda{foundart = Article.find!('matt aimonetti')}.should raise_error
|
344
|
+
end
|
340
345
|
end
|
341
346
|
|
342
347
|
describe "getting a model with a subobjects array" do
|
@@ -578,11 +578,7 @@ describe "ExtendedDocument properties" do
|
|
578
578
|
end
|
579
579
|
|
580
580
|
describe 'when type primitive is a Boolean' do
|
581
|
-
|
582
|
-
use_database DB
|
583
|
-
property :tasty, TrueClass
|
584
|
-
end
|
585
|
-
|
581
|
+
|
586
582
|
[ true, 'true', 'TRUE', '1', 1, 't', 'T' ].each do |value|
|
587
583
|
it "returns true when value is #{value.inspect}" do
|
588
584
|
@course.active = value
|
@@ -605,26 +601,20 @@ describe "ExtendedDocument properties" do
|
|
605
601
|
end
|
606
602
|
|
607
603
|
it "should respond to requests with ? modifier" do
|
608
|
-
@course.active =
|
604
|
+
@course.active = nil
|
609
605
|
@course.active?.should be_false
|
606
|
+
@course.active = false
|
607
|
+
@course.active?.should be_false
|
608
|
+
@course.active = true
|
609
|
+
@course.active?.should be_true
|
610
610
|
end
|
611
611
|
|
612
|
-
it "should
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
RootBeerFloat.new(:tasty => 'false').tasty?.should == false
|
619
|
-
RootBeerFloat.new(:tasty => 'FaLsE').tasty?.should == false
|
620
|
-
RootBeerFloat.new(:tasty => nil).tasty?.should == false
|
621
|
-
end
|
622
|
-
|
623
|
-
end
|
624
|
-
|
625
|
-
describe 'when type primitive is a TrueClass' do
|
626
|
-
it "should respond to requests with ? modifier" do
|
627
|
-
@course.very_active = 'true'
|
612
|
+
it "should respond to requests with ? modifier on TrueClass" do
|
613
|
+
@course.very_active = nil
|
614
|
+
@course.very_active?.should be_false
|
615
|
+
@course.very_active = false
|
616
|
+
@course.very_active?.should be_false
|
617
|
+
@course.very_active = true
|
628
618
|
@course.very_active?.should be_true
|
629
619
|
end
|
630
620
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 5
|
9
|
+
version: 1.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- J. Chris Anderson
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-06-08 00:00:00 +02:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|