spec/lib/flapjack/data/contact_spec.rb in flapjack-0.6.38 vs spec/lib/flapjack/data/contact_spec.rb in flapjack-0.6.39

- old
+ new

@@ -2,14 +2,46 @@ require 'flapjack/data/contact' describe Flapjack::Data::Contact, :redis => true do + it "returns a list of all contacts" do + Flapjack::Data::Contact.add({'id' => '362', + 'first_name' => 'John', + 'last_name' => 'Johnson', + 'email' => 'johnj@example.com' }, + :redis => @redis) + Flapjack::Data::Contact.add({'id' => '363', + 'first_name' => 'Jane', + 'last_name' => 'Janeley', + 'email' => 'janej@example.com'}, + :redis => @redis) + + contacts = Flapjack::Data::Contact.all(:redis => @redis) + contacts.should_not be_nil + contacts.should be_an(Array) + contacts.should have(2).contacts + contacts[0].id.should == '362' + contacts[1].id.should == '363' + end + + it "finds a contact by id" do + Flapjack::Data::Contact.add({'id' => '362', + 'first_name' => 'John', + 'last_name' => 'Johnson', + 'email' => 'johnj@example.com' }, + :redis => @redis) + + contact = Flapjack::Data::Contact.find_by_id('362', :redis => @redis) + contact.should_not be_nil + contact.name.should == "John Johnson" + end + it "finds all contacts for a check on an entity" it "deletes all contacts" - it "adds a contact" - it "returns pagerduty credentials for a contact" + + it "returns a list of entities for a contact" end