Sha256: c85287378b0ef65061ecc038944e0f364efd9692e8f6ca552880af1201bfed96
Contents?: true
Size: 877 Bytes
Versions: 6
Compression:
Stored size: 877 Bytes
Contents
require 'spec_helper' describe MailboxController, type: :controller do let(:mock_box) { {} } before do allow_any_instance_of(described_class).to receive(:authenticate_user!).and_return(true) allow(UserMailbox).to receive(:new).and_return(mock_box) end describe "#index" do it "shows message" do expect(mock_box).to receive(:inbox).and_return(["test"]) get :index expect(response).to be_success expect(assigns[:messages]).to eq(["test"]) end end describe "#delete_all" do it "deletes all messages" do expect(mock_box).to receive(:delete_all) get :delete_all end end describe "#delete" do it "deletes message" do expect(mock_box).to receive(:destroy).with("4") delete :destroy, id: "4" expect(response).to redirect_to(@routes.url_helpers.notifications_path) end end end
Version data entries
6 entries across 6 versions & 1 rubygems