From da58422036f5db0635bf55ff34b03b9986ba86d9 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Fri, 12 Nov 2010 13:41:52 -0800 Subject: [PATCH 1/3] chef typo --- chef/cookbooks/common/recipes/daemontools.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chef/cookbooks/common/recipes/daemontools.rb b/chef/cookbooks/common/recipes/daemontools.rb index 3ce295c3a..a7e1add50 100644 --- a/chef/cookbooks/common/recipes/daemontools.rb +++ b/chef/cookbooks/common/recipes/daemontools.rb @@ -18,7 +18,7 @@ config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/def config.each do |thin| id = thin["port"] #socket = "/tmp/thin_#{id}.sock" - dir = "/service/thin_#{port}" + dir = "/service/thin_#{id}" flags = [] flags << "-c /usr/local/app/diaspora" #directory to run from flags << "-e production" #run in production mode From 47d6f82b5fcb77286428c92809b9a30cc167d731 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Fri, 12 Nov 2010 14:00:28 -0800 Subject: [PATCH 2/3] another little typo --- chef/cookbooks/common/recipes/daemontools.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chef/cookbooks/common/recipes/daemontools.rb b/chef/cookbooks/common/recipes/daemontools.rb index a7e1add50..84e4a4f10 100644 --- a/chef/cookbooks/common/recipes/daemontools.rb +++ b/chef/cookbooks/common/recipes/daemontools.rb @@ -16,9 +16,9 @@ end config = YAML.load_file("/usr/local/app/diaspora/chef/cookbooks/common/files/default/thins.yml") config.each do |thin| - id = thin["port"] + port = thin["port"] #socket = "/tmp/thin_#{id}.sock" - dir = "/service/thin_#{id}" + dir = "/service/thin_#{port}" flags = [] flags << "-c /usr/local/app/diaspora" #directory to run from flags << "-e production" #run in production mode From 506d13335a3fc374b1c587876612c4d92ad6b37f Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 12 Nov 2010 16:05:17 -0600 Subject: [PATCH 3/3] Finally have complete specs for AspectEdit.onDropMove. --- public/javascripts/aspect-edit.js | 2 +- spec/javascripts/aspect-edit-spec.js | 82 +++++++++++++++++++++++----- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 134d661f4..e4a82a11f 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -54,7 +54,7 @@ var AspectEdit = { }); } - if (person.attr('data-aspect_id') != undefined && // request doesn't have an aspect ID yet + if (person.attr('data-aspect_id') != undefined && // a request doesn't have a data-aspect_id, but an existing friend does dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) { $.ajax({ url: "/aspects/move_friend/", diff --git a/spec/javascripts/aspect-edit-spec.js b/spec/javascripts/aspect-edit-spec.js index b65ae396a..94e3460fc 100644 --- a/spec/javascripts/aspect-edit-spec.js +++ b/spec/javascripts/aspect-edit-spec.js @@ -2,19 +2,26 @@ describe("AspectEdit", function() { beforeEach(function() { $('#jasmine_content').html( -'
  • ' + -' Alexander Hamiltom' + -'
  • ' - ); +'
      ' + +'
    • ' + +' Alexander Hamiltom' + +'
    • ' + +'
    ' + +'
      ' + +'
    ' + ); }); describe("initialize", function() { it("calls draggable on ul .person", function() { spyOn($.fn, "draggable"); AspectEdit.initialize(); - expect($.fn.draggable).toHaveBeenCalledWith( - {revert: true, start: AspectEdit.startDrag, - drag: AspectEdit.duringDrag, stop: AspectEdit.stopDrag}); + expect($.fn.draggable).toHaveBeenCalledWith({ + revert: true, + start: AspectEdit.startDrag, + drag: AspectEdit.duringDrag, + stop: AspectEdit.stopDrag + }); expect($.fn.draggable.mostRecentCall.object.selector).toEqual("ul .person"); }); it("calls droppable on .aspect ul.dropzone", function() { @@ -92,30 +99,75 @@ describe("AspectEdit", function() { }); describe("onDropMove", function() { + beforeEach(function() { + spyOn($, "ajax"); + }); + describe("when you drop the friend or request onto the div you dragged it from", function() { + it("doesn't call any ajax stuffs", function() { + var targetAspect = $('.dropzone.ui-droppable[data-aspect_id="guid-of-current-aspect"]'); + $.proxy(AspectEdit.onDropMove, targetAspect)(null, {draggable: $('.person.ui-draggable')}); + expect($.ajax).not.toHaveBeenCalled(); + }); + it("adds the person back into the original div", function() { + var targetAspect = $('.dropzone.ui-droppable[data-aspect_id="guid-of-current-aspect"]'); + spyOn($.fn, "append"); + $.proxy(AspectEdit.onDropMove, targetAspect)(null, {draggable: $('.person.ui-draggable')}); + expect($.fn.append).toHaveBeenCalledWith($('.person.ui-draggable')); + expect($.fn.append.mostRecentCall.object.attr("data-aspect_id")).toEqual("guid-of-current-aspect"); + }); + }); + describe("when moving an existing friend between aspects", function() { + it("calls move_friend", function() { + var targetAspect = $('.dropzone.ui-droppable[data-aspect_id="guid-of-target-aspect"]'); + $.proxy(AspectEdit.onDropMove, targetAspect)(null, {draggable: $('.person.ui-draggable')}); + expect($.ajax).toHaveBeenCalled(); + var args = $.ajax.mostRecentCall.args[0]; + expect(args["url"]).toEqual("/aspects/move_friend/"); + expect(args["data"]["friend_id"]).toEqual("guid-of-this-person"); + expect(args["data"]["from"]).toEqual("guid-of-current-aspect"); + expect(args["data"]["to"]).toEqual({"to": "guid-of-target-aspect" }); + }); + it("doesn't call the ajaxy request delete", function() { + var targetAspect = $('.dropzone.ui-droppable[data-aspect_id="guid-of-target-aspect"]'); + $.proxy(AspectEdit.onDropMove, targetAspect)(null, {draggable: $('.person.ui-draggable')}); + expect($.ajax.calls.length).toEqual(1); + }); + it("adds the person to the aspect div", function() { + var targetAspect = $('.dropzone.ui-droppable[data-aspect_id="guid-of-target-aspect"]'); + spyOn($.fn, "append"); + $.proxy(AspectEdit.onDropMove, targetAspect)(null, {draggable: $('.person.ui-draggable')}); + expect($.fn.append).toHaveBeenCalledWith($('.person.ui-draggable')); + expect($.fn.append.mostRecentCall.object.hasClass("dropzone")).toBeTruthy(); + }); + }); describe("when dragging a friend request", function() { beforeEach(function() { $('#jasmine_content').html( -'
  • ' + -' Alexander Hamiltom' + +'
  • ' + +' Alexander Hamiltom' + '
  • ' + -'
      ' + +'
        ' + '
      ' - ); + ); }); it("deletes the request object", function() { - spyOn($, "ajax"); $.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')}); expect($.ajax).toHaveBeenCalled(); var args = $.ajax.calls[0].args[0]; expect(args["type"]).toEqual("DELETE"); - expect(args["url"]).toEqual("/requests/4cae42d32367bca44e000003"); - expect(args["data"]).toEqual({"accept" : true, "aspect_id" : "4cdae5ed2367bc30aa000007" }); + expect(args["url"]).toEqual("/requests/guid-of-friendship-requestor"); + expect(args["data"]).toEqual({"accept" : true, "aspect_id" : "guid-of-target-aspect" }); }); it("doesn't call move_friend", function() { - spyOn($, "ajax"); $.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')}); expect($.ajax.calls.length).toEqual(1); }); + it("adds the person to the aspect div", function() { + spyOn($.fn, "append"); + $.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')}); + expect($.fn.append).toHaveBeenCalledWith($('.person.ui-draggable')); + expect($.fn.append.mostRecentCall.object.hasClass("dropzone")).toBeTruthy(); + }); }); });