Sha256: ffb07f2c4ec58b2d6b8eaccdfe453b408576b016c2cdf9336a647641999ce94f
Contents?: true
Size: 1.16 KB
Versions: 54
Compression:
Stored size: 1.16 KB
Contents
require 'test_plugin_helper' class JobTemplateEffectiveUserTest < ActiveSupport::TestCase let(:job_template) { FactoryBot.build(:job_template, :job_category => '') } let(:effective_user) { job_template.effective_user } describe 'by default' do it 'is overridable' do assert effective_user.overridable? end it 'does not use the current user' do assert_not effective_user.current_user? end end describe 'compute value' do it 'computes the value based on the current user when current_user set to true' do user = FactoryBot.create(:user) User.current = user effective_user.current_user = true _(effective_user.compute_value).must_equal user.login end it 'returns the value when not current user is set to true' do effective_user.current_user = false effective_user.value = 'testuser' _(effective_user.compute_value).must_equal 'testuser' end it 'returns a default value when no value is specified for the user' do effective_user.value = '' Setting[:remote_execution_effective_user] = 'myuser' _(effective_user.compute_value).must_equal 'myuser' end end end
Version data entries
54 entries across 54 versions & 1 rubygems