Sha256: 2c558a605c9a67a47d18f5a63be39bf4aafa711687e2cac4147da01e374253ea

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Query, organization_workspace: :test do
  let!(:exercise) { create(:problem) }
  let(:student) { create(:user) }

  describe '#submit_question!' do
    let(:assignment) { exercise.find_assignment_for student }

    context 'when just a question on an empty assignment is sent' do
      before { exercise.submit_question!(student, content: 'Please help!') }

      it { expect(assignment.status).to eq :pending }
      it { expect(assignment.result).to be nil }

      it { expect(assignment.solution).to be nil }
      it { expect(assignment.messages.count).to eq 1 }
      it { expect(assignment.submission_id).to_not be nil }
    end

    context 'when a question on a previous submission is sent' do
      before do
        assignment = exercise.submit_solution!(student, content: 'x = 1')
        assignment.failed!
        @original_submission_id = assignment.submission_id
      end

      before { exercise.submit_question!(student, content: 'Please help!') }

      it { expect(assignment.status).to eq :failed }
      it { expect(assignment.result).to eq 'noop result' }
      it { expect(assignment.solution).to eq 'x = 1' }
      it { expect(assignment.messages.count).to eq 1 }
      it { expect(assignment.submission_id).to eq @original_submission_id }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mumuki-laboratory-5.13.0 spec/models/question_spec.rb
mumuki-laboratory-5.12.1 spec/models/question_spec.rb
mumuki-laboratory-5.12.0 spec/models/question_spec.rb
mumuki-laboratory-5.11.0 spec/models/question_spec.rb
mumuki-laboratory-5.10.4 spec/models/question_spec.rb
mumuki-laboratory-5.10.3 spec/models/question_spec.rb
mumuki-laboratory-5.10.2 spec/models/question_spec.rb
mumuki-laboratory-5.10.1 spec/models/question_spec.rb
mumuki-laboratory-5.10.0 spec/models/question_spec.rb
mumuki-laboratory-5.9.1 spec/models/question_spec.rb
mumuki-laboratory-5.9.0 spec/models/question_spec.rb