Skip to content
Extraits de code Groupes Projets
Valider 7a5852e7 rédigé par maxwell's avatar maxwell
Parcourir les fichiers

fix a bug with openssl keys in development. note to future max and

rafi.  never monkey patch anything on the top of a completely random
model. never again. ever.

TODO: look into replacing a monkey patch on a to_s in User#generate_key
that makes the single test green, but my dell had a heart attack other
places, that might just be sqlite3 or my dell
parent 56cdb7a3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,12 +2,6 @@
# 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
belongs_to :sender, :class_name => 'User'
......
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
#
#
#
#Why? as of rails 3.0.4, objects are marshalled by calling to yaml, if it is a text field in the db. since we assume things are strings coming out, and pkey does not seem to define a to_yaml, it was getting set to nil
class OpenSSL::PKey::RSA
def to_yaml
self.to_s
end
end
......@@ -5,10 +5,22 @@
require 'spec_helper'
describe User do
it 'should have a key' do
alice.encryption_key.should_not be nil
end
it 'the key should marshall to and from the db correctly' do
user = User.build(:username => 'max', :email => 'foo@bar.com', :password => 'password', :password_confirmation => 'password')
user.save!
expect{
user.reload.encryption_key
}.should_not raise_error
end
describe 'overwriting people' do
it 'does not overwrite old users with factory' do
lambda {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter