-
Notifications
You must be signed in to change notification settings - Fork 51
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
Error Testing with Rspec #16
Comments
It seems the failure is in the object false
node(:status) { :success }
node(:message) { @message } |
The |
This actually rings a bell - It's exactly what happened to me in #15. |
@fnordfish @ccocchi I actually managed to reproduce the same error in a completely different app. Without even running tests. Here's what happened. I made two routes. Here's the code for index: def index
@users = User.all
@message = "Testing index"
render 'users/index'
end Here's the code for the views: object false
node(:users) { partial('users/_show', object: @users)}
extends 'shared/success' _show.json.rabl attributes :id, :first_name, :last_name, :email shared/success.json.rabl object false
node(:status) { :success }
node(:message) { @message } This action actually displays everything correctly with the JSON when called from the browser the output is like such: {"users":[{"id":18,"first_name":"leo","last_name":"correa","email":"lcorr005@gmail.com"}],"status":"success","message":"Testing index"} Where I can reproduce the issue is here, I have another route called show action def show
@user = User.find(18)
@message = "Hello there"
render 'users/show'
end show.json.rabl object false
node(:user) { partial('users/show', object: @user) }
extends 'shared/success' Error I get is the same:
This is without testing on Rspec or initially having |
Scratch that, It seems that what was causing the error was this node(:user) { partial('users/show', object: @user) } Once I switched it to node(:user) { partial('users/_show', object: @user) } it worked. I'm going to write some rspec tests for it and see if I can replicate the issue |
So I was not able to reproduce the issue with the small app. I'll go back to big app and try to debug and see what the issue was. |
I've got the same: #15 (comment) |
I'm testing the responses with rspec. I previously had set up the views with the
rabl
gem but decided to tryrabl-rails
. All my tests were passing on using therabl
gem but once I made the switch torabl-rails
the tests started failing.The weird thing is that they fail randomly and depending on the seed of the tests. I get the following error:
Here's my view for that specific call:
All my tests fail with that same error but the line
# (eval):13:in 'compile_source'
has different line numbers on different views.Also, it is very random. Depending on the order of the tests, different views will fail but the errors are always the same. Any idea why this is happening?
Edit
Another thing to point out is that not all the views fail depending on the order. Certain views will fail sometimes but others will pass.
The text was updated successfully, but these errors were encountered: