Commit 0d8d17f89e8595f46ddb509cfaae61c021e9cd8c
Committed by
Dmitri Garbuzov
1 parent
d0e9f5a9
Exists in
master
and in
1 other branch
Added test for autoactivating ideas
Showing
2 changed files
with
15 additions
and
0 deletions
Show diff stats
spec/controllers/choices_controller_spec.rb
... | ... | @@ -100,6 +100,14 @@ describe ChoicesController do |
100 | 100 | assigns[:choice].should_not be_active |
101 | 101 | assigns[:choice].user_created.should == true |
102 | 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 | 111 | end |
104 | 112 | |
105 | 113 | end | ... | ... |
spec/controllers/questions_controller_spec.rb
... | ... | @@ -33,5 +33,12 @@ describe QuestionsController do |
33 | 33 | @response.body.should have_tag("visitor_ideas") |
34 | 34 | |
35 | 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 | 44 | end | ... | ... |