-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My FactoryBot error is reoccurring with rack-test 0.8.2 #211
Comments
@aebirim Still waiting on more info on this so we can fix it. |
@perlun, stacktrace for below command:
Is that what you'd like ? If not then let me know. My original error is generated when I run my rspec tests for my models
and my test models are created using FactoryBot |
@aebirim Thanks. What I mean is more something like this:
That way, it's much easier to debug since we then know what class the |
@perlun I get **edit: sorry, right after lunch, misread original code :-D ** filepath = File.new(Rails.root.join('test', 'fixtures', 'uploads', 'foobar.dat'))
post :create, params: { foobar_file: filepath } Obviously not a filepath, but a file. I'm updating our tests to send a path. |
I've hit a similar issue trying to run this feature spec https://gist.github.com/joemsak/771ae438953133230e7093f0ef0eaabf When I'm willing to discover that the problem is on my end somewhere because I was getting this error the other day because the actual problem was an error in the view or the controller -- but I can't remember how I fixed that instance, and now when I try adding And when I test this scenario by hand in my browser, it works fine. |
@aebirim did you ever find a way to work around this or fix this ? |
yep same result as @breckenedge; @PaulBrunache, @perlun got the following: From: gems/ruby-2.4.2/gems/rack-test-0.8.2/lib/rack/test/uploaded_file.rb @ line 33 Rack::Test::UploadedFile#initialize:
The type of the content is File class Please advise. |
Following up after doing some sleuthing on my end... it seems to happen when submitting a form with file fields. I am not testing that part of the form, so I'm not attaching files. This current investigation is not in relation to the gist I linked in my earlier comment. The params look like this at "technical_checklist[paper_prototype]"=>
#<Capybara::RackTest::Form::NilUploadedFile:0x00007fd0ac0a1700
@empty_file=#<File:/var/folders/s7/3_hxsnzs3fg223wk7pk_389c0000gn/T/nil_uploaded_file20171218-30071-1wk5wnd (closed)>>,
"technical_checklist[paper_prototype_cache]"=>"",
"technical_checklist[event_flow_chart]"=>
#<Capybara::RackTest::Form::NilUploadedFile:0x00007fd0ac0a09e0
@empty_file=#<File:/var/folders/s7/3_hxsnzs3fg223wk7pk_389c0000gn/T/nil_uploaded_file20171218-30071-1rcn59p (closed)>>,
|
From Capybara's documentation on Overview I don't see it to be true in the current version of the code that Rack::Test is checking for the class, but I am not an expert on the codebase so I could be wrong |
Following up once again, I've been able to resolve my issue with this change, which does not break the rack-test test suite joemsak@4adbb1c -- all tests that had the error are now passing, and my entire test suite is passing as well (plenty of my tests do involve attaching files) |
Hmmm, I was about to add a test and try to open up the method to a little more polymorphism, when i found this teamcapybara/capybara@95a297eb So now I realize the problem is that thoughtbot/[email protected] is not using teamcapybara/[email protected] which supports at least rack-test/[email protected] |
If you're using capybara-webkit, thoughtbot recommends using the master branch: thoughtbot/capybara-webkit#1044 (comment) I confirm it's working for me |
Stacktrace:
Again works fine with rack-test 0.7.0
The text was updated successfully, but these errors were encountered: