From 4105f90aaab8cdf1432c895842f673e11cf805b6 Mon Sep 17 00:00:00 2001
From: zhitomirskiyi <ilya@joindiaspora.com>
Date: Wed, 9 Feb 2011 19:06:49 -0800
Subject: [PATCH] forgot to add

---
 features/disconnects_users.feature    | 60 +++++++++++++++++++++++++++
 spec/javascripts/contact-list-spec.js | 21 ++++++++++
 2 files changed, 81 insertions(+)
 create mode 100644 features/disconnects_users.feature
 create mode 100644 spec/javascripts/contact-list-spec.js

diff --git a/features/disconnects_users.feature b/features/disconnects_users.feature
new file mode 100644
index 0000000000..422e8beb19
--- /dev/null
+++ b/features/disconnects_users.feature
@@ -0,0 +1,60 @@
+@javascript
+Feature: disconnecting users
+  In order to deal with life
+  As a User
+  I want to be able to disconnect from others
+
+  Background: 
+    Given a user with email "bob@bob.bob" 
+    And a user with email "alice@alice.alice"
+    And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
+   When I sign in as "bob@bob.bob"
+    And I am on the aspects manage page
+   Then I should see 1 contact in "Besties"
+    
+    
+  Scenario: remove contact from the contact show page
+   When I am on "alice@alice.alice"'s page
+    And I follow "edit aspect membership"
+    And I preemptively confirm the alert
+    And I follow "remove contact" in the modal window
+
+    And I wait for the ajax to finish
+    And I am on the aspects manage page
+   Then I should see no contacts in "Besties"
+
+ 
+  Scenario: cancel removing contact from the contact show page
+    When I am on "alice@alice.alice"'s page
+    And I follow "edit aspect membership"
+    And I preemptively reject the alert
+    And I follow "remove contact" in the modal window
+
+    And I wait for the ajax to finish
+    And I am on the aspects manage page
+   Then I should see 1 contact in "Besties"
+
+  Scenario: remove contact from the aspect edit page
+   When I go to the home page
+    And I follow "Besties" within "#aspect_listings"
+
+    And I wait for the ajax to finish
+    And I preemptively confirm the alert
+    And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
+
+    And I wait for the ajax to finish
+    And I am on the aspects manage page
+   Then I should see no contacts in "Besties"
+
+  Scenario: cancel removing contact from the contact show page
+   When I go to the home page
+    And I follow "Besties" within "#aspect_listings"
+    And I wait for the ajax to finish
+
+    And I preemptively reject the alert
+    And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
+
+    And I wait for the ajax to finish
+    And I am on the aspects manage page
+   Then I should see 1 contact in "Besties"
+
diff --git a/spec/javascripts/contact-list-spec.js b/spec/javascripts/contact-list-spec.js
new file mode 100644
index 0000000000..6dc20a316f
--- /dev/null
+++ b/spec/javascripts/contact-list-spec.js
@@ -0,0 +1,21 @@
+/*   Copyright (c) 2010, Diaspora Inc.  This file is
+*   licensed under the Affero General Public License version 3 or later.  See
+*   the COPYRIGHT file.
+*/
+
+describe("Contact List", function() {
+    describe("disconnectUser", function() {
+      it("does an ajax call to person delete with the passed in id", function(){
+        var id = '3';
+        spyOn($,'ajax').andCallThrough();
+        List.disconnectUser(id);
+        expect($.ajax).toHaveBeenCalledWith(
+            url: "/people/" + id,
+            type: "DELETE",
+            success: function(){
+                $('.contact_list li[data-guid='+id+']').fadeOut(200);
+              }
+          );
+      });
+  });
+});
-- 
GitLab