From 8cb21ec79bc92edaf2b792e5c403a2babce1c00d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jul 2019 09:41:18 +1200 Subject: [PATCH] Removing notifications specs --- .../notifications_controller_spec.rb | 75 ------------------- spec/routing/notifications_routing_spec.rb | 33 -------- 2 files changed, 108 deletions(-) delete mode 100644 spec/controllers/notifications_controller_spec.rb delete mode 100644 spec/routing/notifications_routing_spec.rb diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb deleted file mode 100644 index c606d9fe9..000000000 --- a/spec/controllers/notifications_controller_spec.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'rails_helper' - -describe NotificationsController do - login_member - - def valid_attributes - { - "recipient_id" => subject.current_member.id, - "sender_id" => FactoryBot.create(:member).id, - "subject" => 'test' - } - end - - describe "GET index" do - it "assigns all notifications as @notifications" do - notification = FactoryBot.create(:notification, recipient_id: subject.current_member.id) - get :index, params: {} - assigns(:notifications).should eq([notification]) - end - end - - describe "GET show" do - it "assigns the requested notification as @notification" do - notification = FactoryBot.create(:notification, recipient_id: subject.current_member.id) - get :show, params: { id: notification.to_param } - assigns(:notification).should eq(notification) - end - - it "assigns the reply link for a post comment" do - notification = FactoryBot.create(:notification, recipient_id: subject.current_member.id) - - get :show, params: { id: notification.to_param } - assigns(:reply_link).should_not be_nil - assigns(:reply_link).should eq new_comment_url( - post_id: notification.post.id - ) - end - - it "marks notifications as read" do - notification = FactoryBot.create(:notification, recipient_id: subject.current_member.id) - get :show, params: { id: notification.to_param } - # we need to fetch it from the db again, can't test against the old one - n = Notification.find(notification.id) - n.read.should eq true - end - end - - describe "GET reply" do - it "marks notifications as read" do - notification = FactoryBot.create(:notification, recipient_id: subject.current_member.id) - get :reply, params: { notification_id: notification.to_param } - # we need to fetch it from the db again, can't test against the old one - n = Notification.find(notification.id) - n.read.should eq true - end - end - - describe "GET new" do - it "assigns a recipient" do - @recipient = FactoryBot.create(:member) - get :new, params: { recipient_id: @recipient.id } - expect(assigns(:recipient)).to be_an_instance_of(Member) - end - end - - describe "POST create" do - describe "with valid params" do - it "redirects to the recipient's profile" do - @recipient = FactoryBot.create(:member) - post :create, params: { notification: { recipient_id: @recipient.id, subject: 'foo' } } - response.should redirect_to(notifications_path) - end - end - end -end diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb deleted file mode 100644 index bb7335e1b..000000000 --- a/spec/routing/notifications_routing_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require "rails_helper" - -describe NotificationsController do - describe "routing" do - it "routes to #index" do - get("/notifications").should route_to("notifications#index") - end - - it "routes to #new" do - get("/notifications/new").should route_to("notifications#new") - end - - it "routes to #show" do - get("/notifications/1").should route_to("notifications#show", id: "1") - end - - it "routes to #edit" do - get("/notifications/1/edit").should route_to("notifications#edit", id: "1") - end - - it "routes to #create" do - post("/notifications").should route_to("notifications#create") - end - - it "routes to #update" do - put("/notifications/1").should route_to("notifications#update", id: "1") - end - - it "routes to #destroy" do - delete("/notifications/1").should route_to("notifications#destroy", id: "1") - end - end -end