Sha256: ffad6e620070942e07a35bbfe1a4aa83ad35d7bed3bd37a20d1213c284f28f7e
Contents?: true
Size: 1.04 KB
Versions: 32
Compression:
Stored size: 1.04 KB
Contents
require "rails_helper" describe Releaf::Responders::DestroyResponder, type: :controller do let(:controller){ Releaf::ActionController.new } let(:resource){ Book.new} subject{ described_class.new(controller, [resource]) } describe "#to_html" do before do allow(controller).to receive(:request).and_return(request) allow(controller).to receive(:formats).and_return([:html]) allow(subject).to receive(:default_render) end context "when resource has been successfully destroyed" do it "renders success notification" do resource.destroy expect(subject.controller).to receive(:render_notification).with(true, failure_message_key: "cant destroy, because relations exists") subject.to_html end end context "when resource has not been destroyed" do it "renders failure notification" do expect(subject.controller).to receive(:render_notification).with(false, failure_message_key: "cant destroy, because relations exists") subject.to_html end end end end
Version data entries
32 entries across 32 versions & 1 rubygems