uploadcare / uploadcare-rails

Rails API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
MIT License
58 stars 70 forks source link

Error when running tests #68

Closed gonzag88 closed 3 years ago

gonzag88 commented 6 years ago

Hi, i'm having some problems with uploadcare-rails gem when running my tests. Everything seems to be running smoothly on development env, but fails on test env.

Here is the trace (it happens with all kind of tests):

I've tried with different gem versions with same results.

The model

class Announcement < ApplicationRecord
  has_uploadcare_file :image

  # -- Validations
  validates :title, presence: true
  validates :description, presence: true
  validates :image, presence: true
end

Test trace

# Running:                                                                                

#### -------This Faraday error also appeared after adding UploadCare gem
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday

Finished in 0.201850s
  1) Error:                                                                         
AnnouncementTest#test_should_have_a_title:
NoMethodError: undefined method `names' for nil:NilClass from /Users/gonzalo/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/uploadcare-ruby-1.1.0/lib/uploadcare/utils/parser.rb:45:in `parse'

    test/models/announcement_test.rb:10:in `block in <class:AnnouncementTest>'

  2) Error:
AnnouncementTest#test_should_have_a_description:
NoMethodError: undefined method `names' for nil:NilClass from /Users/gonzalo/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/uploadcare-ruby-1.1.0/lib/uploadcare/utils/parser.rb:45:in `parse'

    test/models/announcement_test.rb:16:in `block in <class:AnnouncementTest>'

Any idea? Thanks!

dmitry-mukhin commented 6 years ago

could you check this with 2.0.0 version?

gonzag88 commented 6 years ago

@dmitry-mukhin I'm using uploadcare-rails, which has uploadcare-ruby ~> 1.0 as dependency and cannot be updated. The last version i see is 1.2.0.pre.alpha and i've already tried with that.

Is that what you mean?

dmitry-mukhin commented 6 years ago

Yes, you're right. Let us see what we can do, although it will take some time.

Feel free to try fixing this on your own and send PRs :)

dmitry-mukhin commented 6 years ago

BTW, does your code work in production?

gonzag88 commented 6 years ago

@dmitry-mukhin I've just seen this while having the same error in production. So the answer is No for production environment

dmitry-mukhin commented 6 years ago

@rastyagaev please take a look

stefankp commented 5 years ago

We are having the same issue in production. Anybody still working on this gem?

optlsnd commented 5 years ago

@stefankp sorry for the delay. We're still working on this, but we need some additional time. We'll get back with an update in a few days.

stefankp commented 5 years ago

@optlsnd No worries, we fixed it from our side.

The error happend when passing an empty CDN url https://ucarecdn.com/ to the parser.

optlsnd commented 5 years ago

@stefankp great! thanks for letting us know šŸ‘šŸ¼

dmitrijivanchenko commented 3 years ago

@stefankp, is this issue still actual? We now have v2.0.0. Please, take a look at main

stefankp commented 3 years ago

I moved on from that codebase, so don't know šŸ¤·