ruby - VoltRB rspec testing a method can't convert Promise into Array -


i trying rspec unit tests on method in model. method returns promise, , when resolved, name of person. method not problem know works correctly. here test code:

it 'should return correct name'   report = report.new(first_name: 'testy', last_name: 'testerson')   report.save!   expect(report.name).to eql('testy testerson') end 

when test it, following error:

failure/error: expect(report.name).to eql('testy testerson') typeerror:   can't convert promise array (promise#to_ary gives promise) 

while debugging, used following line inspect returned value of method:

puts report.name.inspect 

and got following response:

#<promise(70319926955580): "testy testerson"> 

the error seems happening because tests promise against expected value. why getting error?

using report.name.value fixes issue


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -