Nested calls seem to be fun..
This commit is contained in:
Ralf Teusner
2017-11-15 15:37:42 +01:00
parent 960025cbf8
commit fc873cb053
7 changed files with 18 additions and 18 deletions

View File

@ -191,7 +191,7 @@ describe SessionsController do
describe 'GET #destroy_through_lti' do describe 'GET #destroy_through_lti' do
let(:request) { proc { get :destroy_through_lti, consumer_id: consumer.id, submission_id: submission.id } } 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 before(:each) do
#Todo replace session with lti_parameter #Todo replace session with lti_parameter

View File

@ -42,7 +42,7 @@ describe SubmissionsController do
end end
context 'with a valid filename' do 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 } before(:each) { get :download_file, filename: file.name_with_extension, id: submission.id }
context 'for a binary file' do context 'for a binary file' do
@ -92,7 +92,7 @@ describe SubmissionsController do
end end
context 'with a valid filename' do 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 } before(:each) { get :render_file, filename: file.name_with_extension, id: submission.id }
context 'for a binary file' do context 'for a binary file' do

View File

@ -3,7 +3,7 @@ require 'seeds_helper'
describe DockerClient, docker: true do describe DockerClient, docker: true do
let(:command) { 'whoami' } 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(:execution_environment) { FactoryBot.build(:java) }
let(:image) { double } let(:image) { double }
let(:submission) { FactoryBot.create(:submission) } let(:submission) { FactoryBot.create(:submission) }

View File

@ -8,7 +8,7 @@ describe FileTree do
context 'for a media file' do context 'for a media file' do
context 'for an audio 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 it 'is an audio file icon' do
expect(file_icon).to include('fa-file-audio-o') expect(file_icon).to include('fa-file-audio-o')
@ -16,7 +16,7 @@ describe FileTree do
end end
context 'for an image file' do 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 it 'is an image file icon' do
expect(file_icon).to include('fa-file-image-o') expect(file_icon).to include('fa-file-image-o')
@ -24,7 +24,7 @@ describe FileTree do
end end
context 'for a video file' do 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 it 'is a video file icon' do
expect(file_icon).to include('fa-file-video-o') expect(file_icon).to include('fa-file-video-o')
@ -42,7 +42,7 @@ describe FileTree do
end end
context 'for an executable file' do 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 it 'is a code file icon' do
expect(file_icon).to include('fa-file-code-o') expect(file_icon).to include('fa-file-code-o')
@ -50,7 +50,7 @@ describe FileTree do
end end
context 'for a renderable file' do 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 it 'is a text file icon' do
expect(file_icon).to include('fa-file-text-o') expect(file_icon).to include('fa-file-text-o')
@ -58,7 +58,7 @@ describe FileTree do
end end
context 'for all other files' do 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 it 'is a generic file icon' do
expect(file_icon).to include('fa-file-o') expect(file_icon).to include('fa-file-o')

View File

@ -69,7 +69,7 @@ describe ExecutionEnvironment do
describe '#valid_test_setup?' do describe '#valid_test_setup?' do
context 'with a test command and a testing framework' 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 it 'is valid' do
expect(execution_environment.errors[:test_command]).to be_blank expect(execution_environment.errors[:test_command]).to be_blank

View File

@ -1,7 +1,7 @@
require 'rails_helper' require 'rails_helper'
describe Submission do 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 it 'validates the presence of a cause' do
expect(described_class.create.errors[:cause]).to be_present expect(described_class.create.errors[:cause]).to be_present
@ -69,7 +69,7 @@ describe Submission do
before(:each) do before(:each) do
10.times.each_with_index do |_, index| 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
end end
@ -99,7 +99,7 @@ describe Submission do
it 'does not redirect other users' do it 'does not redirect other users' do
9.times do |i| 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 expect(submission.send(:redirect_to_feedback?)).to be_falsey
end end
end end
@ -116,7 +116,7 @@ describe Submission do
it 'does not redirect other users' do it 'does not redirect other users' do
9.times do |i| 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 expect(submission.send(:redirect_to_feedback?)).to be_falsey
end end
end end
@ -128,7 +128,7 @@ describe Submission do
it 'sends nobody to feedback page' do it 'sends nobody to feedback page' do
30.times do |i| 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 expect(submission.send(:redirect_to_feedback?)).to be_falsey
end end
end end

View File

@ -18,7 +18,7 @@ describe InternalUserPolicy do
context 'with an admin user' do context 'with an admin user' do
it 'grants access to no one' do it 'grants access to no one' do
[:admin, :external_user, :teacher].each do |factory_name| [: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 end
end end
@ -27,7 +27,7 @@ describe InternalUserPolicy do
it 'grants access to admins only' do it 'grants access to admins only' do
expect(subject).to permit(FactoryBot.build(:admin), InternalUser.new) expect(subject).to permit(FactoryBot.build(:admin), InternalUser.new)
[:external_user, :teacher].each do |factory_name| [: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 end
end end