I have this Code
if @temp_user.save
sign_in(:user, @temp_user)
render text: "OK"
else
render text: render_to_string(:partial => "errors")
end
and I try verify with rspec the render "OK"
this is my actual spec:
it "render text OK" do
post :create, {:agent => valid_attributes}
# response.should have_content("OK")
response.should render_template(:text => "OK")
end
but this spec respond 0 failures always, even when I put "OKI" in place "OK"
anyone have one suggestion for that?
response.body.should == "OK"
works for me
If you are using rails 3 or above
expect(response.body).to eq "OK"
will work
describe "render text OK" do
post :create, {:agent => valid_attributes}
# response.should have_content("OK"
response.should render_template(:text => "OK")
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With