second run of replacement regex from https://github.com/thoughtbot/factory_bot/blob/4-9-0-stable/UPGRADE_FROM_FACTORY_GIRL.md ...
Nested calls seem to be fun..
This commit is contained in:
@ -191,7 +191,7 @@ describe SessionsController do
|
||||
|
||||
describe 'GET #destroy_through_lti' do
|
||||
let(:request) { proc { get :destroy_through_lti, consumer_id: consumer.id, submission_id: submission.id } }
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryGirl.create(:dummy)) }
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryBot.create(:dummy)) }
|
||||
|
||||
before(:each) do
|
||||
#Todo replace session with lti_parameter
|
||||
|
@ -42,7 +42,7 @@ describe SubmissionsController do
|
||||
end
|
||||
|
||||
context 'with a valid filename' do
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryGirl.create(:audio_video)) }
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryBot.create(:audio_video)) }
|
||||
before(:each) { get :download_file, filename: file.name_with_extension, id: submission.id }
|
||||
|
||||
context 'for a binary file' do
|
||||
@ -92,7 +92,7 @@ describe SubmissionsController do
|
||||
end
|
||||
|
||||
context 'with a valid filename' do
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryGirl.create(:audio_video)) }
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryBot.create(:audio_video)) }
|
||||
before(:each) { get :render_file, filename: file.name_with_extension, id: submission.id }
|
||||
|
||||
context 'for a binary file' do
|
||||
|
@ -3,7 +3,7 @@ require 'seeds_helper'
|
||||
|
||||
describe DockerClient, docker: true do
|
||||
let(:command) { 'whoami' }
|
||||
let(:docker_client) { described_class.new(execution_environment: FactoryBot.build(:java), user: FactoryGirl.build(:admin)) }
|
||||
let(:docker_client) { described_class.new(execution_environment: FactoryBot.build(:java), user: FactoryBot.build(:admin)) }
|
||||
let(:execution_environment) { FactoryBot.build(:java) }
|
||||
let(:image) { double }
|
||||
let(:submission) { FactoryBot.create(:submission) }
|
||||
|
@ -8,7 +8,7 @@ describe FileTree do
|
||||
|
||||
context 'for a media file' do
|
||||
context 'for an audio file' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_mp3)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_mp3)) }
|
||||
|
||||
it 'is an audio file icon' do
|
||||
expect(file_icon).to include('fa-file-audio-o')
|
||||
@ -16,7 +16,7 @@ describe FileTree do
|
||||
end
|
||||
|
||||
context 'for an image file' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_jpg)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_jpg)) }
|
||||
|
||||
it 'is an image file icon' do
|
||||
expect(file_icon).to include('fa-file-image-o')
|
||||
@ -24,7 +24,7 @@ describe FileTree do
|
||||
end
|
||||
|
||||
context 'for a video file' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_mp4)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_mp4)) }
|
||||
|
||||
it 'is a video file icon' do
|
||||
expect(file_icon).to include('fa-file-video-o')
|
||||
@ -42,7 +42,7 @@ describe FileTree do
|
||||
end
|
||||
|
||||
context 'for an executable file' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_py)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_py)) }
|
||||
|
||||
it 'is a code file icon' do
|
||||
expect(file_icon).to include('fa-file-code-o')
|
||||
@ -50,7 +50,7 @@ describe FileTree do
|
||||
end
|
||||
|
||||
context 'for a renderable file' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_svg)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_svg)) }
|
||||
|
||||
it 'is a text file icon' do
|
||||
expect(file_icon).to include('fa-file-text-o')
|
||||
@ -58,7 +58,7 @@ describe FileTree do
|
||||
end
|
||||
|
||||
context 'for all other files' do
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryGirl.build(:dot_md)) }
|
||||
let(:file) { FactoryBot.build(:file, file_type: FactoryBot.build(:dot_md)) }
|
||||
|
||||
it 'is a generic file icon' do
|
||||
expect(file_icon).to include('fa-file-o')
|
||||
|
@ -69,7 +69,7 @@ describe ExecutionEnvironment do
|
||||
|
||||
describe '#valid_test_setup?' do
|
||||
context 'with a test command and a testing framework' do
|
||||
before(:each) { execution_environment.update(test_command: FactoryBot.attributes_for(:ruby)[:test_command], testing_framework: FactoryGirl.attributes_for(:ruby)[:testing_framework]) }
|
||||
before(:each) { execution_environment.update(test_command: FactoryBot.attributes_for(:ruby)[:test_command], testing_framework: FactoryBot.attributes_for(:ruby)[:testing_framework]) }
|
||||
|
||||
it 'is valid' do
|
||||
expect(execution_environment.errors[:test_command]).to be_blank
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Submission do
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryGirl.create(:dummy)) }
|
||||
let(:submission) { FactoryBot.create(:submission, exercise: FactoryBot.create(:dummy)) }
|
||||
|
||||
it 'validates the presence of a cause' do
|
||||
expect(described_class.create.errors[:cause]).to be_present
|
||||
@ -69,7 +69,7 @@ describe Submission do
|
||||
|
||||
before(:each) do
|
||||
10.times.each_with_index do |_, index|
|
||||
FactoryBot.create(:submission, exercise: submission.exercise, user: (index.even? ? user : FactoryGirl.create(:external_user)))
|
||||
FactoryBot.create(:submission, exercise: submission.exercise, user: (index.even? ? user : FactoryBot.create(:external_user)))
|
||||
end
|
||||
end
|
||||
|
||||
@ -99,7 +99,7 @@ describe Submission do
|
||||
|
||||
it 'does not redirect other users' do
|
||||
9.times do |i|
|
||||
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryGirl.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
|
||||
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_falsey
|
||||
end
|
||||
end
|
||||
@ -116,7 +116,7 @@ describe Submission do
|
||||
|
||||
it 'does not redirect other users' do
|
||||
9.times do |i|
|
||||
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryGirl.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
|
||||
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_falsey
|
||||
end
|
||||
end
|
||||
@ -128,7 +128,7 @@ describe Submission do
|
||||
|
||||
it 'sends nobody to feedback page' do
|
||||
30.times do |i|
|
||||
submission = FactoryBot.create(:submission, exercise: exercise, user: FactoryGirl.create(:external_user))
|
||||
submission = FactoryBot.create(:submission, exercise: exercise, user: FactoryBot.create(:external_user))
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_falsey
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ describe InternalUserPolicy do
|
||||
context 'with an admin user' do
|
||||
it 'grants access to no one' do
|
||||
[:admin, :external_user, :teacher].each do |factory_name|
|
||||
expect(subject).not_to permit(FactoryBot.build(factory_name), FactoryGirl.build(:admin))
|
||||
expect(subject).not_to permit(FactoryBot.build(factory_name), FactoryBot.build(:admin))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -27,7 +27,7 @@ describe InternalUserPolicy do
|
||||
it 'grants access to admins only' do
|
||||
expect(subject).to permit(FactoryBot.build(:admin), InternalUser.new)
|
||||
[:external_user, :teacher].each do |factory_name|
|
||||
expect(subject).not_to permit(FactoryBot.build(factory_name), FactoryGirl.build(:teacher))
|
||||
expect(subject).not_to permit(FactoryBot.build(factory_name), FactoryBot.build(:teacher))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user