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.
16 lines
313 B
Ruby
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
|