This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new ae3e487  More tests
ae3e487 is described below

commit ae3e487c4f45b56b6e63a6bb303fdd0b2e4ea45a
Author: Sebb <[email protected]>
AuthorDate: Sun Jul 12 20:45:15 2020 +0100

    More tests
---
 lib/spec/lib/member_spec.rb | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/lib/spec/lib/member_spec.rb b/lib/spec/lib/member_spec.rb
index 9f296d9..4a20540 100644
--- a/lib/spec/lib/member_spec.rb
+++ b/lib/spec/lib/member_spec.rb
@@ -20,6 +20,14 @@ describe ASF::Member do
     res = ASF::Member.find_text_by_id('elder')
     expect(res).to match(%r{^El Dorado.+^ Avail ID: elder}m)
   end
+  it  "find_by_email('[email protected]') should return ASF::Person" do
+    res = ASF::Member.find_by_email('[email protected]')
+    expect(res).to be_kind_of(ASF::Person)
+  end
+  it  "find_by_email('invalid@invalid') should return nil" do
+    res = ASF::Member.find_by_email('invalid@invalid')
+    expect(res).to eq(nil)
+  end
   fields = {fullname: 'Full Name', address: "Line 1\nLine2", availid: 'a-b-c', 
email: '[email protected]'}
   it "make_entry() should raise error" do
     expect { ASF::Member.make_entry(fields.reject{|k,v| k == :fullname}) }.to 
raise_error(ArgumentError, ':fullname is required')
@@ -43,5 +51,35 @@ describe ASF::Member do
     res = ASF::Member.make_entry(fields.merge({fax: '123-456'}))
     expect(res).to match(%r{^      Fax: 123-456$})
   end
+  it "status should return hash" do
+    res = ASF::Member.status
+    expect(res).to be_kind_of(Hash)
+    expect(res.size).to eq(3)
+    expect(res.keys.sort).to eq(["cherry", "damson", "elder"])
+  end
+  it "emeritus should return hash" do
+    res = ASF::Member.emeritus
+    expect(res).to be_kind_of(Array)
+    expect(res.size).to eq(2)
+    expect(res.sort).to eq(["cherry", "damson"])
+  end
+  it "find('cherry') should return true" do
+    res = ASF::Member.find('cherry')
+    expect(res).to eq(true)
+  end
+  it "find('notinavail') should return false" do
+    res = ASF::Member.find('notinavail')
+    expect(res).to eq(false)
+  end
+  it "text should return File.read('members.txt')" do
+    exp = File.read(File.join(ASF::SVN['foundation'],'members.txt'))
+    act = ASF::Member.text
+    expect(act).to eq(exp)
+  end
+  it "get_name(find_text_by_id('cherry')) should return Charlie Ryman" do
+    txt = ASF::Member.find_text_by_id('cherry')
+    res = ASF::Member.get_name(txt)
+    expect(res).to eq('Charlie Ryman')
+  end
 end
 

Reply via email to