Reputation: 1345
Any one help me?
This is my rspec_controller.rb
it "#save_request" do
expect(response).to have_http_status(200)
expect(response).not_to have_http_status(302)
should have_content("Success")
end
This is my console error:
1) TimeslotsController#request_timeslot_create #save_request
Failure/Error: should have_content("Success")
expected #<TimeslotsController:0xcc2746c> to respond to `has_content?`
# ./spec/controllers/timeslots_controller_spec.rb:46:in `block (3 levels) in <top (required)>'
Upvotes: 0
Views: 1254
Reputation: 1035
For html_content better use rspec + capybara, and write feature test.
capybara
then you can write expect(page).to have_content("Success")
If you really want to use just rspec controller here is guide
Rspec render views
And last thing name of controller spec should be like: timeslots_controller_spec.rb
Upvotes: 1