This is what I did:
Video.stub!( :has_attached_file ).with( :name ).and_return( true )
has_attached_file is from paperclip, it gets mixed to the model.
1)
RightAws::AwsError in 'VideosController should create a valid Video'
AWS access keys are required to operate on S3
/Users/ngw/zooppa-4/app/controllers/videos_controller.rb:6:in `create'
/Users/ngw/zooppa-4/spec/controllers/videos_controller_spec.rb:17:
Maybe I missed something ?
TIA,
ngw
> Does someone have an example on faking a file upload for just
> ensuring it gets called
http://talklikeaduck.denhaven2.com/articles/2008/04/18/rails-integration-test-file-upload-plugin
Cheers,
David
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
> On Jun 9, 2008, at 7:05 AM, Nicholas Wieland wrote:
>
>> Does someone have an example on faking a file upload for just
>> ensuring it gets called
>
> http://talklikeaduck.denhaven2.com/articles/2008/04/18/rails-integration-test-file-upload-plugin
I haven't been clear enough, my point is not to fake the file upload
(there's also fixture_file_upload for that) but to fake the receiver,
making it dumb enough to avoid performing every operation on the file
(in my case, uploading to s3).
ngw
Rick, I'm interested finding out how to do this, too (Rspec newbie and
really terrible with mocking & stubbing). Are you suggesting we do
something like this (?);
Paperclip.saved_attached_file.stub!(:avatar).and_return(true)
It's nice to be able to spec the app actually working with S3 but, my
specs are taking over 3 minutes now and commenting out all the S3
involved specs kinda makes me nervous!
--
Posted via http://www.ruby-forum.com/.
I am struggling with Webrat and Paperclip. If I specify:
validates_attachment_presence :image, then AR complains because
there is no image set.
Therefore I decide to remove this validation, and instead use:
validates_presence_of :image_file_name, to trick him. But it still
doesn't work. When I create a new object, even if I put:
Product.create!(..., :image_file_name => 'thumb1.png'), AR still
complains and it says that Image file name is missing. There must be
some Paperclip magic which I can't get around.
The only solution I have found is to remove the validation of the
attachment for passing the tests, but I'd like to keep it.
Anyone ran into this previously?
G'day again Fernando. IIRC, Paperclip's #save_attached_files is what
takes care of saving the attachment to disk, uploading it to S3, etc.
Here's a small gist that tests the allowance of JPG files, and ensures
that the file isn't saved [to disk, for me]:
http://gist.github.com/48264
I hope that helps!
Nick
Hi Nick,
Don't ask me why, but this morning I tried once again to simply do:
product.image = File.new('path_to_image.png'), and it worked perfectly
as expected and passed validations and whatever.
--
Posted via http://www.ruby-forum.com/.
I'm glad you got it sorted out =)
hello dear.....
have u got the solution 4 that...then please tell me...
and second one is, from where u get S3 aws_access_key and
aws_secret_access_key and bucket_base_name .. or from wher to set
this.........
thanks
replay me on deven...@trinitywebtech.com
--
Posted via http://www.ruby-forum.com/.