Photo specs passing, 9 failures left in mysql
This commit is contained in:
parent
3e7e99831a
commit
a6dcaa2327
6 changed files with 17 additions and 8 deletions
|
|
@ -15,7 +15,7 @@ class RequestsController < ApplicationController
|
||||||
if params[:aspect_id]
|
if params[:aspect_id]
|
||||||
@contact = current_user.accept_and_respond( params[:id], params[:aspect_id])
|
@contact = current_user.accept_and_respond( params[:id], params[:aspect_id])
|
||||||
flash[:notice] = I18n.t 'requests.destroy.success'
|
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
|
else
|
||||||
flash[:error] = I18n.t 'requests.destroy.error'
|
flash[:error] = I18n.t 'requests.destroy.error'
|
||||||
respond_with @contact, :location => requests_url
|
respond_with @contact, :location => requests_url
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ class Photo < Post
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_photo= remote_path
|
def remote_photo= remote_path
|
||||||
|
pp remote_path
|
||||||
name_start = remote_path.rindex '/'
|
name_start = remote_path.rindex '/'
|
||||||
self.remote_photo_path = remote_path.slice(0, name_start )
|
self.remote_photo_path = remote_path.slice(0, name_start )
|
||||||
self.remote_photo_name = remote_path.slice(name_start + 1, remote_path.length)
|
self.remote_photo_name = remote_path.slice(name_start + 1, remote_path.length)
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ class CreateSchema < ActiveRecord::Migration
|
||||||
t.text :remote_photo_path
|
t.text :remote_photo_path
|
||||||
t.string :remote_photo_name
|
t.string :remote_photo_name
|
||||||
t.string :random_string
|
t.string :random_string
|
||||||
|
t.string :image #carrierwave's column
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ ActiveRecord::Schema.define(:version => 0) do
|
||||||
t.text "remote_photo_path"
|
t.text "remote_photo_path"
|
||||||
t.string "remote_photo_name"
|
t.string "remote_photo_name"
|
||||||
t.string "random_string"
|
t.string "random_string"
|
||||||
|
t.string "image"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,8 @@ describe PhotosController do
|
||||||
|
|
||||||
let(:filename) { 'button.png' }
|
let(:filename) { 'button.png' }
|
||||||
let(:fixture_name) { File.join(File.dirname(__FILE__), '..', 'fixtures', filename) }
|
let(:fixture_name) { File.join(File.dirname(__FILE__), '..', 'fixtures', filename) }
|
||||||
let(:image) { File.open(fixture_name) }
|
let!(:photo1) { user1.post(:photo, :user_file => File.open(fixture_name), :to => aspect1.id) }
|
||||||
let!(:photo1) { user1.post(:photo, :user_file => image, :to => aspect1.id) }
|
let!(:photo2) { user2.post(:photo, :user_file => File.open(fixture_name), :to => aspect2.id) }
|
||||||
let!(:photo2) { user2.post(:photo, :user_file => image, :to => aspect2.id) }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
connect_users(user1, aspect1, user2, aspect2)
|
connect_users(user1, aspect1, user2, aspect2)
|
||||||
|
|
@ -25,10 +24,17 @@ describe PhotosController do
|
||||||
sign_in :user, user1
|
sign_in :user, user1
|
||||||
end
|
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
|
describe '#create' do
|
||||||
before do
|
before do
|
||||||
@controller.stub!(:file_handler).and_return(image)
|
@controller.stub!(:file_handler).and_return(File.open(fixture_name))
|
||||||
@params = {:photo => {:user_file => image, :aspect_ids => "all"} }
|
@params = {:photo => {:user_file => File.open(fixture_name), :aspect_ids => "all"} }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can make a photo' do
|
it 'can make a photo' do
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,10 @@ describe Diaspora::UserModules::Connecting do
|
||||||
|
|
||||||
it "should mark the corresponding notification as 'read'" do
|
it "should mark the corresponding notification as 'read'" do
|
||||||
notification = Notification.create(:target_id => @received_request.id,
|
notification = Notification.create(:target_id => @received_request.id,
|
||||||
:kind => 'new_request',
|
:target_type => 'new_request',
|
||||||
:unread => true)
|
: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)
|
user.accept_contact_request(@received_request, aspect)
|
||||||
Notification.first(:target_id=>@received_request.id).unread.should be_false
|
Notification.first(:target_id=>@received_request.id).unread.should be_false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue