From 0d8d17f89e8595f46ddb509cfaae61c021e9cd8c Mon Sep 17 00:00:00 2001 From: dmitrig Date: Fri, 25 Jun 2010 14:26:37 -0400 Subject: [PATCH] Added test for autoactivating ideas --- spec/controllers/choices_controller_spec.rb | 8 ++++++++ spec/controllers/questions_controller_spec.rb | 7 +++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/spec/controllers/choices_controller_spec.rb b/spec/controllers/choices_controller_spec.rb index 57696ab..f934c2c 100644 --- a/spec/controllers/choices_controller_spec.rb +++ b/spec/controllers/choices_controller_spec.rb @@ -100,6 +100,14 @@ describe ChoicesController do assigns[:choice].should_not be_active assigns[:choice].user_created.should == true end + + it "creates a choice and activates it when set_autoactivate_is set" do + @question.update_attribute(:it_should_autoactivate_ideas, true) + post :create, :question_id => @question.id, :choice => {:data => "blahblah"} + assigns[:choice].should_not be_nil + assigns[:choice].creator.should == @question.site.default_visitor + assigns[:choice].should be_active + end end end diff --git a/spec/controllers/questions_controller_spec.rb b/spec/controllers/questions_controller_spec.rb index e35537b..179a741 100644 --- a/spec/controllers/questions_controller_spec.rb +++ b/spec/controllers/questions_controller_spec.rb @@ -33,5 +33,12 @@ describe QuestionsController do @response.body.should have_tag("visitor_ideas") end + + it "can be set to autoactivate questions" do + put :set_autoactivate_ideas_from_abroad, :id => @question.id, :format => "xml", :question => {:it_should_autoactivate_ideas => true} + assigns[:question].should == @question + assigns[:question].it_should_autoactivate_ideas.should be_true + @response.body.should == "true" + end end -- libgit2 0.21.2