Photo specs passing, 9 failures left in mysql

This commit is contained in:
Raphael 2010-12-26 20:33:21 -08:00
parent 3e7e99831a
commit a6dcaa2327
6 changed files with 17 additions and 8 deletions

View file

@ -15,7 +15,7 @@ class RequestsController < ApplicationController
if params[:aspect_id]
@contact = current_user.accept_and_respond( params[:id], params[:aspect_id])
flash[:notice] = I18n.t 'requests.destroy.success'
respond_with :location => current_user.aspects.where(:id => params[:aspect_id]).first
respond_with @contact, :location => requests_url
else
flash[:error] = I18n.t 'requests.destroy.error'
respond_with @contact, :location => requests_url

View file

@ -41,6 +41,7 @@ class Photo < Post
end
def remote_photo= remote_path
pp remote_path
name_start = remote_path.rindex '/'
self.remote_photo_path = remote_path.slice(0, name_start )
self.remote_photo_name = remote_path.slice(name_start + 1, remote_path.length)

View file

@ -85,6 +85,7 @@ class CreateSchema < ActiveRecord::Migration
t.text :remote_photo_path
t.string :remote_photo_name
t.string :random_string
t.string :image #carrierwave's column
t.timestamps
end

View file

@ -119,6 +119,7 @@ ActiveRecord::Schema.define(:version => 0) do
t.text "remote_photo_path"
t.string "remote_photo_name"
t.string "random_string"
t.string "image"
t.datetime "created_at"
t.datetime "updated_at"
end

View file

@ -15,9 +15,8 @@ describe PhotosController do
let(:filename) { 'button.png' }
let(:fixture_name) { File.join(File.dirname(__FILE__), '..', 'fixtures', filename) }
let(:image) { File.open(fixture_name) }
let!(:photo1) { user1.post(:photo, :user_file => image, :to => aspect1.id) }
let!(:photo2) { user2.post(:photo, :user_file => image, :to => aspect2.id) }
let!(:photo1) { user1.post(:photo, :user_file => File.open(fixture_name), :to => aspect1.id) }
let!(:photo2) { user2.post(:photo, :user_file => File.open(fixture_name), :to => aspect2.id) }
before do
connect_users(user1, aspect1, user2, aspect2)
@ -25,10 +24,17 @@ describe PhotosController do
sign_in :user, user1
end
it 'has working context' do
photo1.url.should_not be_nil
Photo.find(photo1.id).url.should_not be_nil
photo2.url.should_not be_nil
Photo.find(photo2.id).url.should_not be_nil
end
describe '#create' do
before do
@controller.stub!(:file_handler).and_return(image)
@params = {:photo => {:user_file => image, :aspect_ids => "all"} }
@controller.stub!(:file_handler).and_return(File.open(fixture_name))
@params = {:photo => {:user_file => File.open(fixture_name), :aspect_ids => "all"} }
end
it 'can make a photo' do

View file

@ -106,10 +106,10 @@ describe Diaspora::UserModules::Connecting do
it "should mark the corresponding notification as 'read'" do
notification = Notification.create(:target_id => @received_request.id,
:kind => 'new_request',
:target_type => 'new_request',
:unread => true)
Notification.first(:target_id=>@received_request.id).unread.should be_true
Notification.where(:target_id=>@received_request.id).first.unread.should be_true
user.accept_contact_request(@received_request, aspect)
Notification.first(:target_id=>@received_request.id).unread.should be_false
end