Skip to content
Extraits de code Groupes Projets
Valider 63a0a371 rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

width and height should now federate

parent 1b2440f6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -21,6 +21,8 @@ class Photo < ActiveRecord::Base
:medium => photo.url(:thumb_medium),
:large => photo.url(:scaled_full) }
}, :as => :sizes
t.add :height
t.add :width
end
mount_uploader :processed_image, ProcessedImage
......@@ -32,6 +34,9 @@ class Photo < ActiveRecord::Base
xml_attr :text
xml_attr :status_message_guid
xml_attr :height
xml_attr :width
belongs_to :status_message, :foreign_key => :status_message_guid, :primary_key => :guid
validates_associated :status_message
......
......@@ -4,6 +4,13 @@
require 'spec_helper'
def with_carrierwave_processing(&block)
UnprocessedImage.enable_processing = true
val = yield
UnprocessedImage.enable_processing = false
val
end
describe Photo do
before do
@user = alice
......@@ -125,11 +132,9 @@ describe Photo do
context 'with a saved photo' do
before do
UnprocessedImage.enable_processing = true
@photo.unprocessed_image.store! File.open(@fixture_name)
UnprocessedImage.enable_processing = false
with_carrierwave_processing do
@photo.unprocessed_image.store! File.open(@fixture_name)
end
end
it 'should have text' do
@photo.text= "cool story, bro"
......@@ -146,12 +151,11 @@ describe Photo do
end
it 'should not use the imported filename as the url' do
@photo.url.include?(@fixture_filename).should be false
@photo.url(:thumb_medium).include?("/" + @fixture_filename).should be false
@photo.url.should_not include @fixture_filename
@photo.url(:thumb_medium).should_not include ("/" + @fixture_filename)
end
it 'should save the image dimensions' do
@photo.width.should == 40
@photo.height.should == 40
end
......@@ -169,7 +173,9 @@ describe Photo do
describe 'serialization' do
before do
Jobs::ProcessPhoto.perform(@saved_photo.id)
@saved_photo = with_carrierwave_processing do
@user.build_post(:photo, :user_file => File.open(@fixture_name), :to => @aspect.id)
end
@xml = @saved_photo.to_xml.to_s
end
......@@ -181,6 +187,12 @@ describe Photo do
it 'serializes the diaspora_handle' do
@xml.include?(@user.diaspora_handle).should be true
end
it 'serializes the height and width' do
@xml.should include 'height'
@xml.include?('width').should be true
@xml.include?('40').should be true
end
end
describe 'remote photos' 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