Commit 0d8d17f89e8595f46ddb509cfaae61c021e9cd8c

Authored by dmitrig
Committed by Dmitri Garbuzov
1 parent d0e9f5a9

Added test for autoactivating ideas

spec/controllers/choices_controller_spec.rb
@@ -100,6 +100,14 @@ describe ChoicesController do @@ -100,6 +100,14 @@ describe ChoicesController do
100 assigns[:choice].should_not be_active 100 assigns[:choice].should_not be_active
101 assigns[:choice].user_created.should == true 101 assigns[:choice].user_created.should == true
102 end 102 end
  103 +
  104 + it "creates a choice and activates it when set_autoactivate_is set" do
  105 + @question.update_attribute(:it_should_autoactivate_ideas, true)
  106 + post :create, :question_id => @question.id, :choice => {:data => "blahblah"}
  107 + assigns[:choice].should_not be_nil
  108 + assigns[:choice].creator.should == @question.site.default_visitor
  109 + assigns[:choice].should be_active
  110 + end
103 end 111 end
104 112
105 end 113 end
spec/controllers/questions_controller_spec.rb
@@ -33,5 +33,12 @@ describe QuestionsController do @@ -33,5 +33,12 @@ describe QuestionsController do
33 @response.body.should have_tag("visitor_ideas") 33 @response.body.should have_tag("visitor_ideas")
34 34
35 end 35 end
  36 +
  37 + it "can be set to autoactivate questions" do
  38 + put :set_autoactivate_ideas_from_abroad, :id => @question.id, :format => "xml", :question => {:it_should_autoactivate_ideas => true}
  39 + assigns[:question].should == @question
  40 + assigns[:question].it_should_autoactivate_ideas.should be_true
  41 + @response.body.should == "true"
  42 + end
36 43
37 end 44 end