Sha256: b1f2e11a76b27a9358a959220fd62e14a5ceed1af7aceae410008dd5c30b60d0

Contents?: true

Size: 1.39 KB

Versions: 13

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Solution do

  describe '#run_tests!' do
    let(:user) { create(:user) }

    before { expect_any_instance_of(Challenge).to receive(:automated_evaluation_class).and_return(Mumuki::Laboratory::Evaluation::Automated) }
    before { expect_any_instance_of(Language).to receive(:run_tests!).and_return(bridge_response) }

    context 'when results have no expectation' do
      let(:exercise) { create(:x_equal_5_exercise) }
      let(:assignment) { exercise.submit_solution! user }
      let(:bridge_response) { {result: '0 failures', status: :passed} }

      it { expect(assignment.status).to eq(:passed) }
      it { expect(assignment.result).to include('0 failures') }
    end

    context 'when results have expectations' do
      let(:exercise_with_expectations) {
        create(:x_equal_5_exercise, expectations: [{binding: :foo, inspection: :HasComposition}]) }
      let(:assignment) { exercise_with_expectations.submit_solution! user }
      let(:bridge_response) { {
          result: '0 failures',
          status: :passed,
          expectation_results: [binding: 'foo', inspection: 'HasBinding', result: :passed]} }

      it { expect(assignment.status).to eq(:passed) }
      it { expect(assignment.result).to include('0 failures') }
      it { expect(assignment.expectation_results).to eq([{binding: 'foo', inspection: 'HasBinding', result: :passed}]) }
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-5.0.12 spec/models/solution_spec.rb
mumuki-laboratory-5.0.11 spec/models/solution_spec.rb
mumuki-laboratory-5.0.10 spec/models/solution_spec.rb
mumuki-laboratory-5.0.9 spec/models/solution_spec.rb
mumuki-laboratory-5.0.8 spec/models/solution_spec.rb
mumuki-laboratory-5.0.7 spec/models/solution_spec.rb
mumuki-laboratory-5.0.6 spec/models/solution_spec.rb
mumuki-laboratory-5.0.5 spec/models/solution_spec.rb
mumuki-laboratory-5.0.4 spec/models/solution_spec.rb
mumuki-laboratory-5.0.3 spec/models/solution_spec.rb
mumuki-laboratory-5.0.2 spec/models/solution_spec.rb
mumuki-laboratory-5.0.1 spec/models/solution_spec.rb
mumuki-laboratory-5.0.0 spec/models/solution_spec.rb