Hi
Checkout this method *fixture_file_upload* method on
http://api.rubyonrails.org/. It might help you.
On Tuesday, 3 September 2013 21:52:43 UTC+5:30, Weverton Gomes wrote:
>
> Hi,
>
> In our app we have an API and we're creating a new method in one of
> controller to allow file upload. We created a test like this:
>
> it 'should upload and save a zip file with invoices' do
> zip = File.read('spec/support/zip-rails.zip')
>
> post :upload, registry: "11222333000144", file: zip
>
> response.body.should eql(true.to_s)
> end
>
> However, when we run the tests, we getting the following error:
>
> ArgumentError:
> invalid byte sequence in UTF-8
>
> We have already searched and most of results tell about set content-type
> to 'multipart/form-data'. We don't know if is it, but we tryied set
> content-type by many and different ways and the error is still there.
>
> Do somebody know about this??
>
> Thanks,
>
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/a3c05ba3-d148-4fbb-b3a5-4e2d4b95dbc4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.