Sha256: 4ce22f5ad976723c8a7fae668498b1d1e7ffc77f7ba403914ad7612450c98d8a
Contents?: true
Size: 933 Bytes
Versions: 7
Compression:
Stored size: 933 Bytes
Contents
require 'spec_helper' describe ExercisesController, organization_workspace: :test do let(:user) { create(:user) } let(:problem) { create(:problem) } let!(:exam) { create :exam, exercises: [problem], duration: 10, start_time: 1.hour.ago, end_time: 1.hour.since } before { reindex_current_organization! } before { set_current_user! user } describe 'show' do context 'when user is in the middle of an exam' do let!(:exam_authorization) { create :exam_authorization, exam: exam, user: user, started: true, started_at: started_at } before { get :show, params: { id: problem.id } } context 'when user is not out of time yet' do let(:started_at) { 5.minutes.ago } it { expect(response.status).to eq 200 } end context 'when user is out of time' do let(:started_at) { 20.minutes.ago } it { expect(response.status).to eq 410 } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems