How to test the locals on a render?

Asked

Viewed 46 times

0

I am with the following doubt, I do my tests using Ministest, but I have a problem when testing the locals of a render... I do not know how to test, example:

Controller:

def salvou
   render('cadastro/salvou', locals: {id: params[:id]})
end

in this case my saved is a js file.

Testing:

it "Redireciona para o salvou" do
    [...]
    assert_template 'cadastro/salvou'
end

and the locals, how I test?

Grateful!

1 answer

1

# assert that the "_customer" partial was rendered with a specific object
assert_template partial: '_customer', locals: { customer: @customer }

ref.: Actioncontroller::Testcase

Browser other questions tagged

You are not signed in. Login or sign up in order to post.