Sha256: 7ecf6a35cdeb2373e84a2cbed4fb6b02101c473c6476c424f017d72faf1b48cd

Contents?: true

Size: 1.42 KB

Versions: 102

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe GuideProgressController, organization_workspace: :test do
  let(:user) { create(:user) }

  let(:exam_problem) { build(:problem) }
  let(:test_organization) { Organization.find_by_name('test') }
  let(:exam) { create(:exam, organization: test_organization, guide: exam_guide) }
  let(:lesson) { create(:lesson, guide: lesson_guide) }

  describe 'delete' do
    before { set_current_user! user }

    describe 'an exam guide progress' do
      let(:exam_guide) { create(:guide, exercises: [exam_problem])}
      before { exam.index_usage! test_organization }
      before { reindex_current_organization! }
      before { delete :destroy, params: { guide_id: exam_guide.id } }

      it { expect(response.status).to eq 403 }
    end

    describe 'a lesson guide progress' do
      let(:book) { create(:book,
                          slug: 'mumuki/book',
                          chapters: [
                            create(:chapter,
                                   slug: 'mumuki/topic1',
                                   lessons: [lesson])]) }

      let(:lesson_guide) { create(:guide, exercises: [exam_problem])}
      before { test_organization.update! book: book }
      before { lesson.index_usage! test_organization }
      before { reindex_current_organization! }
      before { delete :destroy, params: { guide_id: lesson_guide.id } }

      it { expect(response.status).to eq 302 }
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.22.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.21.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.20.1 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.20.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.19.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.18.1 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.18.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.17.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.16.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.15.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.14.1 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.14.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.13.2 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.13.1 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.13.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.12.1 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.12.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.11.0 spec/controllers/guide_progress_controller_spec.rb
mumuki-laboratory-9.10.0 spec/controllers/guide_progress_controller_spec.rb