Skip to content

Commit

Permalink
* Fix warnings thrown by Imagemagick about empty files for tests.
Browse files Browse the repository at this point in the history
* Updated docs for what needs to be installed.
  • Loading branch information
peakpg committed May 10, 2012
1 parent f9ca5cb commit 4881005
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
Binary file modified test/fixtures/multipart/foo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/multipart/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def should_validate_uniqueness_of(options)
end
end


# Read the actual file contents and return them as a string.
def file_contents(path_to_file)
open(path_to_file) {|f| f.read }
end

def self.subclasses_from_module(module_name)
subclasses = []
mod = module_name.constantize
Expand Down
11 changes: 5 additions & 6 deletions test/unit/behaviors/attaching_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,13 @@ def test_updating_the_attachment_file_name
end

test "update the file" do
@file = mock_file
@file = mock_file(:original_filename => 'version2.txt')
@attachable.attachments[0].data = @file
update_attachable
assert_equal @file.read, open(@attachable.attachments[0].full_file_location) { |f| f.read }

assert_equal file_contents(@file.path), file_contents(@attachable.attachments[0].full_file_location)

#assert_equal @file.read, open(@attachable.attachments[0].full_file_location) { |f| f.read }
end

private
Expand Down Expand Up @@ -329,10 +332,6 @@ def update_attachable
@attachable.update_attributes(:name => "Foo v2")
end

# Read the actual file contents and return them as a string.
def file_contents(path_to_file)
open(path_to_file) {|f| f.read }
end
end


Expand Down
4 changes: 2 additions & 2 deletions test/unit/mock_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def teardown


test "mock files can have data read from them" do
file = mock_file()
file = mock_file(:original_filename=>"version1.txt")
assert_not_nil file.path
assert_equal "", open(file.path) { |f| f.read }
assert_equal "v1", open(file.path) { |f| f.read }
end
end
9 changes: 1 addition & 8 deletions todo_list.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Tasks:

* Paperclip Based Assets - Replace the existing 'custom' file upload behavior with one that uses Paperclip. Allow blocks to have more than one attachment.
- Attachments are versioned, but have no connection to their original versioned block. Need to keep the original version id in it attachments table

- Lots of attachment and file/image tests are commented out. They need to be rewritten and tested.
- Class reloading causes Attachments to 'lose' their paperclip configuration in development mode. Need to figure out why and fix it.
- Figure out plan for Migrating from pre-Paperclip attachments. The file structure is different for storing them now.
Expand All @@ -16,13 +16,6 @@ When almost certainly should be.

- Another Versioning related Bug: Blocks with has_many :autosave=>true does not work. The callbacks do not trigger when the block is saved.


Get rid of WARNING (Paperclip?)
sh: identify: command not found
Need to install ImageMagick and configure the command via:
http://stackoverflow.com/questions/4900905/imagemagick-and-paperclip-problem
Paperclip.options[:command_path] = "/opt/local/bin/"

# Path Calculations
- Need to test multiple attachments and what happens

Expand Down

0 comments on commit 4881005

Please sign in to comment.