Files
codeocean/spec/models/external_user_spec.rb
Sebastian Serth 99bd46af1a Align project files with CodeHarbor
Since both projects are developed together and by the same team, we also want to have the same code structure and utility methods available in both projects. Therefore, this commit changes many files, but without a functional change.
2023-10-11 00:18:33 +02:00

46 lines
974 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ExternalUser do
let(:user) { described_class.create }
it 'validates the presence of a consumer' do
expect(user.errors[:consumer]).to be_present
end
it 'validates the presence of an external ID' do
expect(user.errors[:external_id]).to be_present
end
describe '#admin?' do
it 'is false' do
expect(build(:external_user).admin?).to be false
end
end
describe '#external_user?' do
it 'is true' do
expect(user.external_user?).to be true
end
end
describe '#internal_user?' do
it 'is false' do
expect(user.internal_user?).to be false
end
end
describe '#teacher?' do
it 'is false' do
expect(build(:external_user).teacher?).to be false
end
end
describe 'external_user has no current_study_group_id' do
it 'defaults to being a learner' do
expect(build(:external_user).learner?).to be true
end
end
end