mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
@@ -34,14 +34,24 @@ module Spree
|
||||
end
|
||||
|
||||
def find_dimensions
|
||||
temporary = attachment.queued_for_write[:original]
|
||||
filename = temporary.path unless temporary.nil?
|
||||
filename = attachment.path if filename.blank?
|
||||
geometry = Paperclip::Geometry.from_file(filename)
|
||||
return if attachment.errors.present?
|
||||
|
||||
geometry = Paperclip::Geometry.from_file(local_filename_of_original)
|
||||
|
||||
self.attachment_width = geometry.width
|
||||
self.attachment_height = geometry.height
|
||||
end
|
||||
|
||||
def local_filename_of_original
|
||||
temporary = attachment.queued_for_write[:original]
|
||||
|
||||
if temporary&.path.present?
|
||||
temporary.path
|
||||
else
|
||||
attachment.path
|
||||
end
|
||||
end
|
||||
|
||||
# if there are errors from the plugin, then add a more meaningful message
|
||||
def no_attachment_errors
|
||||
return if attachment.errors.empty?
|
||||
|
||||
@@ -4,12 +4,14 @@ require 'spec_helper'
|
||||
require 'rake'
|
||||
|
||||
describe 'users.rake' do
|
||||
before(:all) do
|
||||
Rake.application.rake_require 'tasks/users'
|
||||
Rake::Task.define_task(:environment)
|
||||
end
|
||||
|
||||
describe ':remove_enterprise_limit' do
|
||||
context 'when the user exists' do
|
||||
it 'sets the enterprise_limit to the maximum integer' do
|
||||
Rake.application.rake_require 'tasks/users'
|
||||
Rake::Task.define_task(:environment)
|
||||
|
||||
max_integer = 2_147_483_647
|
||||
user = create(:user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user