Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
removed validation of file presence, as it's not neccessary, updated …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
rngtng committed Feb 23, 2010
1 parent 6ec9aed commit abdac14
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/models/asset.rb
@@ -1,9 +1,13 @@
class Asset < ActiveRecord::Base

has_attached_file :file

validates_attachment_presence :file
#validates_attachment_presence :file
validates_presence_of :uuid

def uuid=(uuid)
@uuid = uuid
end

def uuid
@uuid ||= Asset.generate_uuid
end
Expand Down
24 changes: 23 additions & 1 deletion test/functional/assets_controller_test.rb
Expand Up @@ -3,9 +3,31 @@
class AssetsControllerTest < ActionController::TestCase

test "should show index" do

get :index
assert_response :success
end

test "should show new" do
get :new
assert_response :success
end

test "should show asset" do
asset = Asset.create!
get :show, { :id => asset.reload.id}
assert_response :success
end

test "should create asset" do
comment = "test"
asset = Asset.new
post :create, { :asset => { :uuid => asset.uuid, :comment => comment }}

assert_response :success

assert_equal comment, assigns(:asset).comment
assert_equal asset.uuid, assigns(:asset).uuid
end


end

0 comments on commit abdac14

Please sign in to comment.