<commit_before>require 'spec_helper'
require 'rails_helper'

describe Teachers::ClassroomActivitiesController, type: :controller do
  let(:classroom) { create(:classroom)}
  let(:teacher) { classroom.owner }
  let(:classroom_activity) { create(:classroom_activity, classroom_id: classroom.id)}
  let(:classroom_activity2) { create(:classroom_activity, classroom_id: classroom.id)}
  let(:classroom_activity3) { create(:classroom_activity, classroom_id: classroom.id)}

  before do
    session[:user_id] = teacher.id
  end

  describe '#update' do
    it 'should be able to update due dates' do
      new_due_date = '01-01-2020'
      put :update, id: classroom_activity.id, classroom_activity: {due_date: new_due_date}
      expect(Date.parse(JSON.parse(response.body).first['due_date'])).to eq Date.parse(new_due_date)
    end
  end

  describe '#update_multiple_due_dates' do
    it 'should be able to update due dates for an array of classroom activity ids' do
      new_due_date = '01-01-2020'
      put :update_multiple_due_dates, {classroom_activity_ids: [classroom_activity.id, classroom_activity2.id, classroom_activity3.id], due_date: new_due_date}
      classroom_activity.reload
      classroom_activity2.reload
      classroom_activity3.reload
      expect(classroom_activity.due_date).to eq new_due_date
      expect(classroom_activity2.due_date).to eq new_due_date
      expect(classroom_activity3.due_date).to eq new_due_date
    end
  end

end<commit_msg>Fix broken test to specify that these CAs are all in the same unit<commit_after>require 'spec_helper'
require 'rails_helper'

describe Teachers::ClassroomActivitiesController, type: :controller do
  let(:classroom) { create(:classroom)}
  let(:teacher) { classroom.owner }
  let(:classroom_activity) { create(:classroom_activity, classroom_id: classroom.id)}
  let(:classroom_activity2) { create(:classroom_activity, classroom_id: classroom.id, unit_id: classroom_activity.unit.id)}
  let(:classroom_activity3) { create(:classroom_activity, classroom_id: classroom.id, unit_id: classroom_activity.unit.id)}

  before do
    session[:user_id] = teacher.id
  end

  describe '#update' do
    it 'should be able to update due dates' do
      new_due_date = '01-01-2020'
      put :update, id: classroom_activity.id, classroom_activity: {due_date: new_due_date}
      expect(Date.parse(JSON.parse(response.body).first['due_date'])).to eq Date.parse(new_due_date)
    end
  end

  describe '#update_multiple_due_dates' do
    it 'should be able to update due dates for an array of classroom activity ids' do
      new_due_date = '01-01-2020'
      put :update_multiple_due_dates, {classroom_activity_ids: [classroom_activity.id, classroom_activity2.id, classroom_activity3.id], due_date: new_due_date}
      expect(classroom_activity.reload.due_date).to eq new_due_date
      expect(classroom_activity2.reload.due_date).to eq new_due_date
      expect(classroom_activity3.reload.due_date).to eq new_due_date
    end
  end

end
{'fraction_non_alphanumeric': 0.0962566844919786, 'fraction_numerical': 0.01537433155080214, 'mean_word_length': 4.997995991983968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4823599', 'n_tokens_mistral': 968, 'n_tokens_neox': 938, 'n_words': 213}