Sha256: 22bfc5ff59bec952d8f1db6209d5b60d3b0fa4b2c40cf2c08923ccce8224c8cd

Contents?: true

Size: 964 Bytes

Versions: 13

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'

describe Guide 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.assignment_for(extra_user)).to be_nil
    end

    it 'does not destroy other guides assignments' do
      expect(another_exercise.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

13 entries across 13 versions & 1 rubygems

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