Merge pull request #553 from amoeba/add_specs_for_agent_destroy

Add two specs for Agent#destroy to cover redirects

Andrew Cantino 9 jaren geleden
bovenliggende
commit
6661589743
1 gewijzigde bestanden met toevoegingen van 14 en 0 verwijderingen
  1. 14 0
      spec/controllers/agents_controller_spec.rb

+ 14 - 0
spec/controllers/agents_controller_spec.rb

@@ -292,5 +292,19 @@ describe AgentsController do
292 292
         delete :destroy, :id => agents(:jane_website_agent).to_param
293 293
       }.should raise_error(ActiveRecord::RecordNotFound)
294 294
     end
295
+
296
+    it "redirects correctly when the Agent is deleted from the Agent itself" do
297
+      sign_in users(:bob)
298
+
299
+      delete :destroy, :id => agents(:bob_website_agent).to_param
300
+      response.should redirect_to agents_path
301
+    end
302
+
303
+    it "redirects correctly when the Agent is deleted from a Scenario" do
304
+      sign_in users(:bob)
305
+
306
+      delete :destroy, :id => agents(:bob_weather_agent).to_param, :return => scenario_path(scenarios(:bob_weather)).to_param
307
+      response.should redirect_to scenario_path(scenarios(:bob_weather))
308
+    end
295 309
   end
296 310
 end