On Tuesday, September 3, 2013 10:08:41 AM UTC-7, Weverton Gomes wrote:
> Myron,
>
> I will try it. But, before, can you tell me the correct way to set the
> content-type of the request??
>
I would if I knew. I haven't used rails in years and don't remember how to
do it. Even if I did remember how to do it, it may have changed...
> Thanks,
>
> Em terça-feira, 3 de setembro de 2013 13h36min18s UTC-3, Myron Marston
> escreveu:
>>
>> On Tuesday, September 3, 2013 9:22:43 AM UTC-7, 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,
>>>
>>>
>> 1) Without a backtrace it's hard to give any suggestions; your post
>> doesn't give enough context to guess where that error is originating from.
>> 2) rspec-rails wraps rails' test support, and things like this generally
>> just delegate to the rails methods underneath. I suspect that this is a
>> general issue with rails and not an rspec-specific issue that we'd be able
>> to solve in rspec-rails. I encourage you to try writing your test with
>> just rails' built-in test support and seeing if the error still happens.
>> From there, you can report it to rails or seek help there.
>>
>> Myron
>>
>
--
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/fca44e90-3660-4804-adbb-d3fb62a115f6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.