Files
nairobi/spec/controllers/related_contents_controller_spec.rb
Julian Herrero 9a23393535 Use find instead of find_by_id
This method will raise an exception if resource is not found when
trying to call score_action on nil.
Prefer to raise a 404 HTML NotFound error instead.
2019-01-25 09:03:56 +01:00

16 lines
313 B
Ruby

require "rails_helper"
describe RelatedContentsController do
describe "#score" do
it "raises an error if related content does not exist" do
controller.params[:id] = 0
expect do
controller.send(:score, "action")
end.to raise_error ActiveRecord::RecordNotFound
end
end
end