Displaying 12 results from an estimated 12 matches for "fixture_file_upload".
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing s...
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" # "..../myapp/test/
fixtures/"
end
and I have my test.jpg in "..../myapp/t...
2011 Aug 31
5
3.1rc8 - posting files in a test no longer works
A previously working test, that posted a file object no longer works
in the latest 3.1. The test looks like this:
params[:media][:new_attachment] = File.open("#{Rails.root}/test/data/
less_than_100.png")
post :create, params
In the controller, I obviously expect params[:media][:new_attachment]
to be a File object - and it used to be. Now it looks like #inspect
has been called on the
2007 Dec 11
14
Attachment-fu + Story Runner
Hi all,
I''m trying to run a Story Runner integration test that uploads a file
through Attachment-fu.
I''ve tried various ways of specifying the file data, from custom mocks:
class MockFile < Struct.new
(:original_filename, :read, :content_type); end
fdata = MockFile.new "test_upload.txt", "Test Upload", "text/plain"
to
2006 May 01
10
large file storing in postgres sucks?
Hi,
I''m not sure if this is a postgres issue or not, but I''m using
Postgres 8.1. I have (in my functional tests) the following code:
upload = fixture_file_upload(''/files/podcast.mp3'', ''audio/mpeg'')
post :create, :product => valid_product, :media => { :image => upload }
And then in the controller:
blob = Blob.create :data => uploaded_file.read
When /files/podcast.mp3 is 32 megabytes and I run the test,...
2006 May 01
0
Testing File Upload error
I am trying to build some tests where a file is uploaded and than
processed by file column. Perhaps I am misunderstanding the new
fixture_file_upload that was introduced in 1.1 but I can''t seem to
get it to work correctly. I am trying to run a functional test to
make sure that a redirect is made to the appropriate page from a
create action. I create an issue and the issue can have a picture
attached to it, and depending on if th...
2007 Apr 24
1
Testing for multipart form uploads
...tegration tests that require uploading files via
multipart posts.
Have seen a very similar discussion, but cannot get it to work. Maybe,
it''s out of date now with Rails 1.2.3:
http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/fdfd2c040a2425f4
>From what I understand, fixture_file_upload''s output is translated a
String. There''s a ticket discussing this here:
http://dev.rubyonrails.org/ticket/4635
The solution there is to use code that does the multipart encoding:
integration_test_file_upload.rb
Again, it doesn''t work. The file I''m getting is a t...
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
...subject { @car }
it { should respond_to(:uploads) }
it { should be_valid }
end
cars.rb factory
FactoryGirl.define do
factory :car do
# Something
uploads
end
end
I have tried `uploads { FactoryGirl.create!(:upload) }` as well as using
the `fixture_file_upload` directly on the Car's uploads attribute. Also
I read about Associations,but I wasn't sure how that work.
For the upload factory I've done how you would test an individual
attachment
Uploads.rb
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :upload d...
2008 Jun 09
10
Testing file attachment with Paperclip
Does someone have an example on faking a file upload for just ensuring
it gets called, without actually uploading the file to s3.
I thought that stubbing Model.has_attached_file would be enough, but
it doesn''t seem so ...
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)
2008 Jan 28
0
attachment_fu with fixtures
Dear list,
I can''t figure out how to use fixtures with attachment_fu. I know how
to use files with RSpec in my controllers,
BackgroundPhoto.create(:uploaded_data => fixture_file_upload("files/
some.zip", "application/x-zip")), but this does not work with
fixtures(obviously). More importantly I have no idea where to start...
Can someone shed some light on this?
With kind regards,
Harm
2011 Sep 02
1
Rails 3.1.0 File Upload Rspec Test
I''m having this odd problem that I encountered, today. I want to check
that when I upload a CSV file that it does import some records into a
DB. Problem is that sometimes when I run RSpec it seems that it wants
to read the uploaded file as a string, rather than an object that I am
sending with a post request. Here''s a gist of my code:
https://gist.github.com/1187861
With Rails
2008 Jan 21
5
attachment_fu and story runner, any updates
I''m trying to write a story for a Rails app which involves using the
attachment_fu plugin to upload images.
After blunting my pick on this for a while, google found me this:
http://www.ruby-forum.com/topic/134743#600831
So it seems that there''s a hole in Rails integration testing and
multipart form posting. David offered to incorporate a patch to story
runner at the end of the