|
65 | 65 | it 'changes the question type and deletes the old question when valid' do |
66 | 66 | question = create(:open_question) |
67 | 67 |
|
68 | | - new_question = question.switch_to( |
| 68 | + question.switch_to( |
69 | 69 | 'ScaleQuestion', |
70 | | - {}, |
71 | | - { minimum: 1, maximum: 2 }) |
| 70 | + { minimum: 1, maximum: 2 } |
| 71 | + ) |
72 | 72 |
|
73 | | - new_question.errors.should be_empty |
74 | | - submittable = new_question.submittable |
| 73 | + question.errors.should be_empty |
| 74 | + submittable = question.submittable |
75 | 75 | submittable.should be_a(ScaleSubmittable) |
76 | 76 | submittable.minimum.should eq 1 |
77 | 77 | submittable.maximum.should eq 2 |
78 | 78 | Question.count.should eq 1 |
| 79 | + OpenSubmittable.count.should eq 0 |
79 | 80 | end |
80 | 81 |
|
81 | 82 | it 'leaves the question alone when the new attributes are invalid' do |
82 | 83 | question = create(:open_question) |
83 | 84 |
|
84 | | - new_question = question.switch_to('ScaleQuestion', {}, { minimum: 1 }) |
| 85 | + question.switch_to('ScaleQuestion', { minimum: 1 }) |
85 | 86 |
|
86 | | - new_question.errors.should be_present |
87 | | - new_question.submittable.should be_a(ScaleSubmittable) |
88 | | - new_question.submittable.minimum.should eq 1 |
| 87 | + question.errors.should be_present |
| 88 | + question.submittable.should be_a(ScaleSubmittable) |
| 89 | + question.submittable.minimum.should eq 1 |
89 | 90 | end |
90 | 91 | end |
0 commit comments