Sha256: 9eae42938c8f23333ec2f57b09e77ff78cc16b329f5b8bd1bab4fba0ebfbc039

Contents?: true

Size: 1005 Bytes

Versions: 11

Compression:

Stored size: 1005 Bytes

Contents

require 'spec_helper'

describe Guide, organization_workspace: :test do
  let!(:extra_user) { create(:user, first_name: 'Ignatius', last_name: 'Reilly') }
  let(:guide) { create(:guide) }

  describe '#clear_progress!' do
    let(:an_exercise) { create(:exercise) }
    let(:another_exercise) { create(:exercise) }

    before do
      guide.exercises = [an_exercise]
      an_exercise.submit_solution! extra_user
      another_exercise.submit_solution! extra_user
      guide.clear_progress!(extra_user)
    end

    it 'destroys the guides assignments for the given user' do
      expect(an_exercise.find_assignment_for(extra_user)).to be_nil
    end

    it 'does not destroy other guides assignments' do
      expect(another_exercise.find_assignment_for(extra_user)).to be_truthy
    end
  end

  describe '#submission_contents_for' do
    before do
      guide.exercises = [create(:exercise, language: guide.language), create(:exercise, language: guide.language)]
      guide.save!
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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