From eee2225f04fedfbed6ca8081069108ce222c83d1 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Tue, 12 Jul 2011 19:25:57 -0700 Subject: [PATCH] rspec is green --- app/controllers/invitations_controller.rb | 1 - app/helpers/comments_helper.rb | 2 +- app/models/invitation.rb | 7 ++++++- app/models/user.rb | 2 +- spec/controllers/people_controller_spec.rb | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 653d58660..39f4e891f 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -55,7 +55,6 @@ class InvitationsController < Devise::InvitationsController user.accept_invitation!(params[:user]) user.seed_aspects rescue Exception => e #What exception is this trying to rescue? If it is ActiveRecord::NotFound, we should say so. - raise e user = nil record = e.record record.errors.delete(:person) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index ef1a2bced..a8edd58ba 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -20,6 +20,6 @@ module CommentsHelper def new_comment_form(post_id, current_user) @form ||= controller.render_to_string( :partial => 'comments/new_comment', :locals => {:post_id => GSUB_THIS, :current_user => current_user}) - @form.gsub(GSUB_THIS, post_id.to_s) + @form.gsub(GSUB_THIS, post_id.to_s).html_safe end end diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 078b18d56..e600f8a0a 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -1,6 +1,12 @@ # Copyright (c) 2010, Diaspora Inc. This file is # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. +# +class OpenSSL::PKey::RSA + def to_yaml + self.to_s + end +end class Invitation < ActiveRecord::Base @@ -26,7 +32,6 @@ class Invitation < ActiveRecord::Base raise "You already invited this person" end end - opts[:existing_user] = existing_user create_invitee(opts) end diff --git a/app/models/user.rb b/app/models/user.rb index d75b91f4d..008bfac03 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -343,7 +343,7 @@ class User < ActiveRecord::Base def self.generate_key key_size = (Rails.env == 'test' ? 512 : 4096) - OpenSSL::PKey::RSA::generate key_size + OpenSSL::PKey::RSA::generate(key_size) end def encryption_key diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index eadac9b60..7bb2b4d95 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -39,7 +39,7 @@ describe PeopleController do :profile => Factory.build(:profile, :first_name => "Eugene", :last_name => "w")) get :index, :q => "Eug" - assigns[:people].should =~ [@eugene, eugene2] + assigns[:people].map{|x| x.id}.should =~ [@eugene.id, eugene2.id] end it "excludes people that are not searchable" do @@ -55,7 +55,7 @@ describe PeopleController do :profile => Factory.build(:profile, :first_name => "Eugene", :last_name => "w", :searchable => false)) get :index, :q => "eugene@example.org" - assigns[:people].should =~ [eugene2] + assigns[:people][0].id.should == eugene2.id end it "does not redirect to person page if there is exactly one match" do