Sha256: 807465756ad2cbc95d9a916582a361ce108f94b65b177dd35c56f560cce226a8

Contents?: true

Size: 994 Bytes

Versions: 8

Compression:

Stored size: 994 Bytes

Contents

require_relative '../spec_helper'

require 'wright/util/file_owner'

describe Wright::Util::FileOwner do
  before(:each) do
    @owner = Wright::Util::FileOwner.new
  end

  describe '#user_and_group=' do
    it 'should set the user' do
      @owner.group = 'group'
      @owner.user_and_group = 'user'
      @owner.user.must_equal 'user'
      @owner.group.must_equal 'group'
    end

    it 'should set the user when given a uid' do
      @owner.user_and_group = 23
      @owner.user.must_equal 23
    end

    it 'should support user:group notation' do
      @owner.user_and_group = 'user:group'
      @owner.user.must_equal 'user'
      @owner.group.must_equal 'group'
    end

    it 'should reject user:group strings with invalid notation' do
      invalid_owner = 'user:group:something:else'
      invalid_call = -> { @owner.user_and_group = invalid_owner }
      e = invalid_call.must_raise ArgumentError
      e.message.must_equal "Invalid owner: '#{invalid_owner}'"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wright-0.4.4 spec/util/file_owner_spec.rb
wright-0.4.3 spec/util/file_owner_spec.rb
wright-0.4.2 spec/util/file_owner_spec.rb
wright-0.4.1 spec/util/file_owner_spec.rb
wright-0.4.0 spec/util/file_owner_spec.rb
wright-0.3.2 spec/util/file_owner_spec.rb
wright-0.3.1 spec/util/file_owner_spec.rb
wright-0.3.0 spec/util/file_owner_spec.rb