I've found myself doing this a lot lately... how can I improve the declaration of the paperclip fixture? (sorry, noob question I know)
class ProjectTest < ActiveSupport::TestCase
def xxx
project = Project.new({
:name => 'xxx',
:attachment => File.new(Rails.root + 'test/fixtures/files/attachments/xxx.psd')
})
project.save
project
end
test "should not save project without name" do
assert xxx, "Saved project without a name"
end
test "should save a project with an attachment and have a valid directory" do
assert File.directory?(xxx.directory), "Saved project without establishing a valid directory"
end
test "should save a project with an attachment and have a URL" do
assert !xxx.filename.nil?, "Saved project without establishing a valid URL"
end
test "should save a project with an attachment and have a valid absolute file path" do
assert File.exists?(xxx.absolute_filename), "Saved project without establishing a valid absolute filename"
end
test "should save a project with an attachment and have a valid base filename" do
assert !xxx.base_filename.nil?, "Saved project without establishing a valid base filename"
end
end