Questions: fixes, redesign form, fix edit error
This commit is contained in:
parent
38bc2e3c3a
commit
e25425bd77
20 changed files with 300 additions and 117 deletions
26
spec/controllers/admin/questions_controller_spec.rb
Normal file
26
spec/controllers/admin/questions_controller_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::QuestionsController do
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:question_with_answers) { create(:question_with_answers) }
|
||||
let!(:question_without_answers) { create(:question) }
|
||||
let(:organizer) { create(:organizer) }
|
||||
|
||||
describe 'PATCH #update_conference' do
|
||||
before(:each) do
|
||||
sign_in(organizer)
|
||||
end
|
||||
|
||||
it 'enables a question for a conference if the question has answers' do
|
||||
patch :toggle_question, conference_id: conference.short_title, id: question_with_answers, enable: 'true'
|
||||
|
||||
conference.reload
|
||||
|
||||
expect(conference.question_ids).to eq([question_with_answers.id])
|
||||
expect(conference.question_ids).to_not include([question_without_answers.id])
|
||||
|
||||
expect(flash[:notice]).to eq("Questions for #{conference.short_title} successfully updated. Note: Only questions with answers can be enabled for a conference.")
|
||||
expect(response).to redirect_to admin_conference_questions_path(conference.short_title)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue