diff --git a/spec/factories.rb b/spec/factories.rb index 2bdd82a..3273854 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -22,6 +22,17 @@ Factory.define(:aoi_question, :parent => :question) do |f| end result end + f.prompts do |question| + result = [] + 1.times do + result << Factory.build(:prompt, + :question => question.result, + :left_choice => question.choices.first, + :right_choice => question.choices.second) + + end + result + end end Factory.define(:visitor) do |f| diff --git a/spec/models/choice_spec.rb b/spec/models/choice_spec.rb index 1f92e81..c9ecd6c 100644 --- a/spec/models/choice_spec.rb +++ b/spec/models/choice_spec.rb @@ -25,12 +25,12 @@ describe Choice do Choice.create!(@valid_attributes) end - it "should generate prompts after two choices are created" do - proc { - choice1 = Choice.create!(@valid_attributes.merge(:data => '1234')) - choice2 = Choice.create!(@valid_attributes.merge(:data => '1234')) - }.should change(@question.prompts, :count).by(2) - end + #it "should generate prompts after two choices are created" do + # proc { +# choice1 = Choice.create!(@valid_attributes.merge(:data => '1234')) +# choice2 = Choice.create!(@valid_attributes.merge(:data => '1234')) +# }.should change(@question.prompts, :count).by(2) +# end it "should deactivate a choice" do choice1 = Choice.create!(@valid_attributes.merge(:data => '1234')) diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb index c0d9e88..5de71b6 100644 --- a/spec/models/question_spec.rb +++ b/spec/models/question_spec.rb @@ -33,9 +33,9 @@ describe Question do q.choices(true).size.should == 0 end - it "should generate prompts after choices are added" do - @question.prompts(true).size.should == 2 - end + #it "should generate prompts after choices are added" do + #@question.prompts(true).size.should == 2 + #end it "should choose an active prompt randomly" do prompt = @question.picked_prompt @@ -127,9 +127,6 @@ describe Question do # Sanity check @catchup_q.choices.size.should == 100 - #the catchup algorithm depends on all prompts being generated automatically - @catchup_q.prompts.size.should == 100 **2 - 100 - prompt = @catchup_q.catchup_choose_prompt prompt.active?.should == true end -- libgit2 0.21.2