Sha256: 29838c412490a3ec420fce7cd6a9eaecdd264872bfda3a3d67f010079bd9fa0c

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

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

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

    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

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-7.11.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-c92f2a7212e2/spec/models/question_spec.rb
mumuki-laboratory-7.11.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-2e15c3330133/spec/models/question_spec.rb
mumuki-laboratory-7.9.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-7082a83493eb/spec/models/question_spec.rb
mumuki-laboratory-7.9.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-b162dc91aa77/spec/models/question_spec.rb
mumuki-laboratory-7.9.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-520f859ca8af/spec/models/question_spec.rb
mumuki-laboratory-7.7.1 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/spec/models/question_spec.rb
mumuki-laboratory-7.7.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-cb7a9018bb94/spec/models/question_spec.rb
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/spec/models/question_spec.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/spec/models/question_spec.rb
mumuki-laboratory-7.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-acb12583b793/spec/models/question_spec.rb
mumuki-laboratory-7.1.0 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-925adf85cca8/spec/models/question_spec.rb
mumuki-laboratory-7.0.12 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-74da3d4af98c/spec/models/question_spec.rb
mumuki-laboratory-7.0.11 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-f892f79c60f0/spec/models/question_spec.rb