ruby-fs-stack 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ruby-fs-stack/enunciate/familytree.rb +3509 -1977
- data/lib/ruby-fs-stack/familytree/relationship.rb +0 -42
- data/lib/ruby-fs-stack/fs_utils.rb +2 -1
- data/ruby-fs-stack.gemspec +4 -2
- data/spec/ruby-fs-stack/familytree/communicator_spec.rb +2 -2
- data/spec/ruby-fs-stack/familytree/json/person/relationship_read.js +54 -1
- data/spec/ruby-fs-stack/familytree/json/person/spouse_read_spouse.js +509 -0
- data/spec/ruby-fs-stack/familytree/person_spec.rb +22 -21
- data/spec/ruby-fs-stack/fs_communicator_spec.rb +15 -1
- data/spec/ruby-fs-stack/json/fakeweb_expired_session.txt +14 -0
- metadata +5 -3
@@ -430,65 +430,66 @@ describe Org::Familysearch::Ws::Familytree::V2::Schema::Person do
|
|
430
430
|
end
|
431
431
|
|
432
432
|
describe "marriages" do
|
433
|
+
|
433
434
|
before(:each) do
|
434
|
-
@person = parse_person('
|
435
|
+
@person = parse_person('spouse_read_spouse.js')
|
435
436
|
end
|
436
|
-
|
437
|
+
|
437
438
|
it "should accept a spouse id." do
|
438
|
-
@person.marriages('
|
439
|
+
@person.marriages('KWNJ-DJM')
|
439
440
|
end
|
440
|
-
|
441
|
+
|
441
442
|
it "should return an array of marriage elements" do
|
442
|
-
marriages = @person.marriages('
|
443
|
+
marriages = @person.marriages('KWNJ-DJM')
|
443
444
|
marriages.should be_instance_of(Array)
|
444
445
|
end
|
445
|
-
|
446
|
+
|
446
447
|
it "should return all marriages" do
|
447
|
-
marriages = @person.marriages('
|
448
|
-
marriages[0].date.normalized.should == '
|
449
|
-
marriages[1].date.normalized.should == '
|
448
|
+
marriages = @person.marriages('KWNJ-DJM')
|
449
|
+
marriages[0].date.normalized.should == '4 November 1847'
|
450
|
+
marriages[1].date.normalized.should == '4 November 1846'
|
450
451
|
end
|
451
|
-
|
452
|
+
|
452
453
|
describe "checking for cases where there are no assertsions, events, or marriages" do
|
453
454
|
before(:each) do
|
454
|
-
@spouse = @person.relationships.spouses.find{|s|s.requestedId=='
|
455
|
+
@spouse = @person.relationships.spouses.find{|s|s.requestedId=='KWNJ-DJM'}
|
455
456
|
end
|
456
|
-
|
457
|
+
|
457
458
|
it "should return [] if no assertions" do
|
458
459
|
@spouse.assertions = nil
|
459
|
-
@person.marriages('
|
460
|
+
@person.marriages('KWNJ-DJM').should == []
|
460
461
|
end
|
461
|
-
|
462
|
+
|
462
463
|
it "should return [] if no events" do
|
463
464
|
@spouse.assertions.events = nil
|
464
|
-
@person.marriages('
|
465
|
+
@person.marriages('KWNJ-DJM').should == []
|
465
466
|
end
|
466
|
-
|
467
|
+
|
467
468
|
end
|
468
469
|
end
|
469
470
|
|
470
471
|
describe "divorces" do
|
471
472
|
before(:each) do
|
472
|
-
@person = parse_person('
|
473
|
+
@person = parse_person('spouse_read_spouse.js')
|
473
474
|
end
|
474
475
|
|
475
476
|
it "should accept a spouse id." do
|
476
|
-
@person.divorces('
|
477
|
+
@person.divorces('KWNJ-DJM')
|
477
478
|
end
|
478
479
|
|
479
480
|
it "should return an array of marriage elements" do
|
480
|
-
divorces = @person.divorces('
|
481
|
+
divorces = @person.divorces('KWNJ-DJM')
|
481
482
|
divorces.should be_instance_of(Array)
|
482
483
|
end
|
483
484
|
|
484
485
|
it "should return all marriages" do
|
485
|
-
divorces = @person.divorces('
|
486
|
+
divorces = @person.divorces('KWNJ-DJM')
|
486
487
|
divorces[0].date.normalized.should == '1912'
|
487
488
|
end
|
488
489
|
|
489
490
|
describe "checking for cases where there are no assertsions, events, or marriages" do
|
490
491
|
before(:each) do
|
491
|
-
@spouse = @person.relationships.spouses.find{|s|s.requestedId=='
|
492
|
+
@spouse = @person.relationships.spouses.find{|s|s.requestedId=='KWNJ-DJM'}
|
492
493
|
end
|
493
494
|
|
494
495
|
it "should return [] if no assertions" do
|
@@ -268,7 +268,7 @@ describe FsCommunicator do
|
|
268
268
|
}.should raise_error(RubyFsStack::BadRequest)
|
269
269
|
end
|
270
270
|
|
271
|
-
it "should raise a
|
271
|
+
it "should raise a Unauthorized on a 401" do
|
272
272
|
fake_web(@path,'401',"Unauthorized")
|
273
273
|
lambda{
|
274
274
|
@com.get(@path)
|
@@ -278,6 +278,20 @@ describe FsCommunicator do
|
|
278
278
|
}.should raise_error(RubyFsStack::Unauthorized)
|
279
279
|
end
|
280
280
|
|
281
|
+
it "should raise an Unauthorized on a 401.23" do
|
282
|
+
response = File.join(File.dirname(__FILE__),'json','fakeweb_expired_session.txt')
|
283
|
+
FakeWeb.register_uri(:get, "https://api.familysearch.org#{@path}?sessionId=SESSID&dataFormat=application/json",
|
284
|
+
:response => response)
|
285
|
+
FakeWeb.register_uri(:post, "https://api.familysearch.org#{@path}?sessionId=SESSID&dataFormat=application/json",
|
286
|
+
:response => response)
|
287
|
+
lambda{
|
288
|
+
@com.get(@path)
|
289
|
+
}.should raise_error(RubyFsStack::Unauthorized)
|
290
|
+
lambda{
|
291
|
+
@com.post(@path,"")
|
292
|
+
}.should raise_error(RubyFsStack::Unauthorized)
|
293
|
+
end
|
294
|
+
|
281
295
|
it "should raise a Forbidden on 403" do
|
282
296
|
fake_web(@path,'403',"Forbidden")
|
283
297
|
lambda{
|
@@ -0,0 +1,14 @@
|
|
1
|
+
HTTP/1.1 401 [401.23] No Session Found
|
2
|
+
Date: Wed, 08 Dec 2010 14:57:51 GMT
|
3
|
+
APP_SVR_ID: 49.89
|
4
|
+
X-PROCESSING-TIME: 44
|
5
|
+
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
6
|
+
Cache-Control: no-cache
|
7
|
+
Cache-Control: no-store
|
8
|
+
WWW-Authenticate: FamilySearchSession
|
9
|
+
Content-Type: application/json;charset=utf-8
|
10
|
+
Content-Language: en-US
|
11
|
+
Content-Length: 149
|
12
|
+
Connection: close
|
13
|
+
|
14
|
+
{"status":[{"message":"No Session Found","code":401,"subcode":23}],"version":"2.7.20100917.6225","statusCode":401,"statusMessage":"No Session Found"}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 3
|
9
|
+
version: 0.5.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jimmy Zimmerman
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-31 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- spec/ruby-fs-stack/familytree/json/person/relationship_read.js
|
109
109
|
- spec/ruby-fs-stack/familytree/json/person/relationship_update.js
|
110
110
|
- spec/ruby-fs-stack/familytree/json/person/spouse_read.js
|
111
|
+
- spec/ruby-fs-stack/familytree/json/person/spouse_read_spouse.js
|
111
112
|
- spec/ruby-fs-stack/familytree/json/search.js
|
112
113
|
- spec/ruby-fs-stack/familytree/match_spec.rb
|
113
114
|
- spec/ruby-fs-stack/familytree/note_spec.rb
|
@@ -120,6 +121,7 @@ files:
|
|
120
121
|
- spec/ruby-fs-stack/fs_utils_spec.rb
|
121
122
|
- spec/ruby-fs-stack/identity/communicator_spec.rb
|
122
123
|
- spec/ruby-fs-stack/identity/json/login.js
|
124
|
+
- spec/ruby-fs-stack/json/fakeweb_expired_session.txt
|
123
125
|
- spec/ruby-fs-stack_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
125
127
|
has_rdoc: true
|