From d4bf2f539dbf3e7b2159a29a758f39f1713939c9 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 18 Jun 2010 10:48:37 -0700 Subject: [PATCH] DG MS; removed signup link and route --- app/controllers/status_messages_controller.rb | 2 +- app/views/devise/shared/_links.haml | 6 ++-- config/routes.rb | 2 +- lib/common.rb | 2 +- spec/lib/common_spec.rb | 30 +++++++++++++++++-- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 22d4b023b..5b53d898e 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -1,5 +1,5 @@ class StatusMessagesController < ApplicationController - #before_filter :authenticate_user! + before_filter :authenticate_user! include StatusMessagesHelper def index diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml index a7547353f..5da9aab33 100644 --- a/app/views/devise/shared/_links.haml +++ b/app/views/devise/shared/_links.haml @@ -1,9 +1,9 @@ - if controller_name != 'sessions' = link_to "Sign in", new_session_path(resource_name) %br/ -- if devise_mapping.registerable? && controller_name != 'registrations' - = link_to "Sign up", new_registration_path(resource_name) - %br/ +/- if devise_mapping.registerable? && controller_name != 'registrations' +/= link_to "Sign up", new_registration_path(resource_name) +/%br/ - if devise_mapping.recoverable? && controller_name != 'passwords' = link_to "Forgot your password?", new_password_path(resource_name) %br/ diff --git a/config/routes.rb b/config/routes.rb index efdc9426f..7d6f2a0a0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,7 @@ Diaspora::Application.routes.draw do |map| devise_for :users, :path_names => {:sign_up => "signup", :sign_in => "login", :sign_out => "logout"} match 'login', :to => 'devise/sessions#new', :as => "new_user_session" match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" - match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration" + #match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration" match 'receive', :to => 'dashboard#receive' diff --git a/lib/common.rb b/lib/common.rb index 779b8034c..2c20d85cc 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -3,7 +3,7 @@ module Diaspora module Webhooks def self.included(klass) klass.class_eval do - before_save :notify_friends + after_save :notify_friends @@queue = MessageHandler.new diff --git a/spec/lib/common_spec.rb b/spec/lib/common_spec.rb index 0e9a3ebf9..90cf185b2 100644 --- a/spec/lib/common_spec.rb +++ b/spec/lib/common_spec.rb @@ -1,11 +1,13 @@ require File.dirname(__FILE__) + '/../spec_helper' + include Diaspora describe Diaspora do describe Webhooks do before do + @user = Factory.create(:user) @post = Factory.build(:post) end @@ -30,11 +32,35 @@ describe Diaspora do end it "should send all prepped webhooks to be processed" do - MessageHandler.any_instance.stubs(:add_post_request).returns(true) - MessageHandler.any_instance.stubs(:process).returns(true) + MessageHandler.any_instance.stubs(:add_post_request).returns true + MessageHandler.any_instance.stubs(:process).returns true @post.notify_friends.should be true end + + it "should check that it only sends a user's posts to their friends" do + Factory.create(:friend, :url => "http://www.bob.com") + Factory.create(:friend, :url => "http://www.alice.com") + Factory.create(:status_message) + Factory.create(:bookmark) + # this is a messagequeue thing; out of scope for webhooks action + end + + it "should ensure no duplicate url posts" do + pending + # this is a messagequeue thing; out of scope for webhooks action + + end + + it "should build an xml object containing multiple Post types" do + Factory.create(:status_message) + Factory.create(:bookmark) + + stream = Post.stream + xml = Post.build_xml_for(stream) + xml.should include "" + xml.should include "" + end end end