Any idea how to debug? On Feb 16, 9:52 am, rtacconi <[email protected]> wrote: > I have a video model using Paperclip to store the file. The model: > > class Video < ActiveRecord::Base > belongs_to :category > before_save :permalink > > validates_presence_of :title > validates_presence_of :category > validates_attachment_presence :filepath, :message => '- please, > select a file to updload' > validates_attachment_size :filepath, :less_than => 100.megabytes > validates_attachment_content_type :filepath, :content_type => > ['video/x-flv'], > :message => '- You can > upload only Flash movies' > > has_attached_file :filepath, > :url => APP_CONFIG['url']+"/videos/inline/:id", > :path => ":rails_root/ > uploads/:attachment/:id/:style/:basename.:extension" > > named_scope :videos_in_category, > lambda { |category_id| > {:conditions => ["category_id = ?", category_id]} > } > > private > def permalink > slug = Slug.new > self.url_slug = slug.url_friendly self.title > end > end > > When I run this test: > > test "should create video" do > assert_difference('Video.count') do > video = videos :videos_002 > video.filepath = File.new("#{RAILS_ROOT}/test/fixtures/ > add_file.flv") > video.filepath_content_type = 'video/x-flv' > category = categories(:intranet_administration) > post :create, :video => { :title => video.title, > :description => video.description, > :category_id => category.id, > :filepath => video.filepath, > :filepath_file_size => > File.size("#{RAILS_ROOT}/test/fixtures/add_file.flv"), > :filepath_content_type => 'video/x- > flv', > :url_slug => video.url_slug} > end > > assert_redirected_to video_path(assigns(:video)) > end > > I get this message: > > "Video.count" didn't change by 1. > <2> expected but was > <1>. > > I tried to understand why it is not created but I do not get any > feedback. Do you have an idea how to solve this? > > Thanks.
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

