Commit 64a0f42e20fca45db2129bd5f5027e9aa1bdf785

Authored by Dhruv Kapadia
1 parent 1be015eb

Fixing failing tests that no longer apply

spec/factories.rb
@@ -22,6 +22,17 @@ Factory.define(:aoi_question, :parent => :question) do |f| @@ -22,6 +22,17 @@ Factory.define(:aoi_question, :parent => :question) do |f|
22 end 22 end
23 result 23 result
24 end 24 end
  25 + f.prompts do |question|
  26 + result = []
  27 + 1.times do
  28 + result << Factory.build(:prompt,
  29 + :question => question.result,
  30 + :left_choice => question.choices.first,
  31 + :right_choice => question.choices.second)
  32 +
  33 + end
  34 + result
  35 + end
25 end 36 end
26 37
27 Factory.define(:visitor) do |f| 38 Factory.define(:visitor) do |f|
spec/models/choice_spec.rb
@@ -25,12 +25,12 @@ describe Choice do @@ -25,12 +25,12 @@ describe Choice do
25 Choice.create!(@valid_attributes) 25 Choice.create!(@valid_attributes)
26 end 26 end
27 27
28 - it "should generate prompts after two choices are created" do  
29 - proc {  
30 - choice1 = Choice.create!(@valid_attributes.merge(:data => '1234'))  
31 - choice2 = Choice.create!(@valid_attributes.merge(:data => '1234'))  
32 - }.should change(@question.prompts, :count).by(2)  
33 - end 28 + #it "should generate prompts after two choices are created" do
  29 + # proc {
  30 +# choice1 = Choice.create!(@valid_attributes.merge(:data => '1234'))
  31 +# choice2 = Choice.create!(@valid_attributes.merge(:data => '1234'))
  32 +# }.should change(@question.prompts, :count).by(2)
  33 +# end
34 34
35 it "should deactivate a choice" do 35 it "should deactivate a choice" do
36 choice1 = Choice.create!(@valid_attributes.merge(:data => '1234')) 36 choice1 = Choice.create!(@valid_attributes.merge(:data => '1234'))
spec/models/question_spec.rb
@@ -33,9 +33,9 @@ describe Question do @@ -33,9 +33,9 @@ describe Question do
33 q.choices(true).size.should == 0 33 q.choices(true).size.should == 0
34 end 34 end
35 35
36 - it "should generate prompts after choices are added" do  
37 - @question.prompts(true).size.should == 2  
38 - end 36 + #it "should generate prompts after choices are added" do
  37 + #@question.prompts(true).size.should == 2
  38 + #end
39 39
40 it "should choose an active prompt randomly" do 40 it "should choose an active prompt randomly" do
41 prompt = @question.picked_prompt 41 prompt = @question.picked_prompt
@@ -127,9 +127,6 @@ describe Question do @@ -127,9 +127,6 @@ describe Question do
127 # Sanity check 127 # Sanity check
128 @catchup_q.choices.size.should == 100 128 @catchup_q.choices.size.should == 100
129 129
130 - #the catchup algorithm depends on all prompts being generated automatically  
131 - @catchup_q.prompts.size.should == 100 **2 - 100  
132 -  
133 prompt = @catchup_q.catchup_choose_prompt 130 prompt = @catchup_q.catchup_choose_prompt
134 prompt.active?.should == true 131 prompt.active?.should == true
135 end 132 end