Skip to content
Extraits de code Groupes Projets
Valider de3a08d0 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Took out putses

parent 10e01c0a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
class Photo < Post class Photo < Post
require 'carrierwave/orm/mongomapper' require 'carrierwave/orm/mongomapper'
include MongoMapper::Document include MongoMapper::Document
before_validation {puts "I'M GONNA VALIDATE"}
before_save {puts "I'M GONNA SAVE"}
before_create {puts "I'M GONNA CREATE"}
mount_uploader :image, ImageUploader mount_uploader :image, ImageUploader
end end
...@@ -44,6 +44,7 @@ policy :diaspora, :roles => [:tom, :backer] do ...@@ -44,6 +44,7 @@ policy :diaspora, :roles => [:tom, :backer] do
requires :scm requires :scm
end end
=begin =begin
policy :ci, :roles => :ci do policy :ci, :roles => :ci do
requires :tools requires :tools
requires :rubygems requires :rubygems
...@@ -54,6 +55,7 @@ policy :ci, :roles => :ci do ...@@ -54,6 +55,7 @@ policy :ci, :roles => :ci do
requires :scm requires :scm
#add sqlite #add sqlite
end end
=end =end
# Deployment # Deployment
# #
......
...@@ -21,14 +21,12 @@ ...@@ -21,14 +21,12 @@
protected protected
def sign_if_mine def sign_if_mine
puts "In sign_if_mine"
if self.person == User.owner if self.person == User.owner
self.creator_signature = sign self.creator_signature = sign
end end
end end
def sign def sign
puts "signing"
sign_with_key(User.owner.key) sign_with_key(User.owner.key)
end end
......
...@@ -4,6 +4,8 @@ describe Photo do ...@@ -4,6 +4,8 @@ describe Photo do
before do before do
@user = Factory.create(:user) @user = Factory.create(:user)
@fixture_name = File.dirname(__FILE__) + '/../fixtures/bp.jpeg' @fixture_name = File.dirname(__FILE__) + '/../fixtures/bp.jpeg'
@fail_fixture_name = File.dirname(__FILE__) + '/../fixtures/msg.xml'
end end
it 'should save a photo to GridFS' do it 'should save a photo to GridFS' do
photo = Photo.new(:person => @user) photo = Photo.new(:person => @user)
...@@ -15,8 +17,12 @@ describe Photo do ...@@ -15,8 +17,12 @@ describe Photo do
binary.should == fixture_binary binary.should == fixture_binary
end end
it 'should create thumbnails' do it 'should not accept files of non-image types' do
pending('need to figure this out... tearing issue') photo = Photo.new(:person => @user)
file = File.open(@fail_fixture_name)
photo.image = file
photo.save.should == false
end end
describe 'with encryption' do describe 'with encryption' do
......
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