Files
codeocean/spec/db/seeds_spec.rb
2021-11-01 17:13:10 +01:00

28 lines
886 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe 'seeds' do
subject(:seed) { Rake::Task['db:seed'].invoke }
before do
CodeOcean::Application.load_tasks
# We want to execute the seeds for the dev environment against the test database
# rubocop:disable Rails/Inquiry
allow(Rails).to receive(:env) { 'development'.inquiry }
# rubocop:enable Rails/Inquiry
allow(ActiveRecord::Base).to receive(:establish_connection).and_call_original
allow(ActiveRecord::Base).to receive(:establish_connection).with(:development) {
ActiveRecord::Base.establish_connection(:test)
}
allow_any_instance_of(ExecutionEnvironment).to receive(:working_docker_image?).and_return true
end
describe 'execute db:seed', cleaning_strategy: :truncation do
it 'collects the test results' do
expect { seed }.not_to raise_error
end
end
end