Sha256: 3ef7217139adb77c246aca92d79a83055a201456d9084957490f74bf6adb176d

Contents?: true

Size: 1.78 KB

Versions: 72

Compression:

Stored size: 1.78 KB

Contents

#
# Author:: Tim Smith (<tsmith@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "spec_helper"

describe Chef::Resource::UserUlimit do
  let(:node) { Chef::Node.new }
  let(:events) { Chef::EventDispatch::Dispatcher.new }
  let(:run_context) { Chef::RunContext.new(node, {}, events) }
  let(:resource) { Chef::Resource::UserUlimit.new("fakey_fakerton", run_context) }

  it "the username property is the name_property" do
    expect(resource.username).to eql("fakey_fakerton")
  end

  it "sets the default action as :create" do
    expect(resource.action).to eql([:create])
  end

  it "coerces filename value to end in .conf" do
    resource.filename("foo")
    expect(resource.filename).to eql("foo.conf")
  end

  it "if username is * then the filename defaults to 00_all_limits.conf" do
    resource.username("*")
    expect(resource.filename).to eql("00_all_limits.conf")
  end

  it "if username is NOT * then the filename defaults to USERNAME_limits.conf" do
    expect(resource.filename).to eql("fakey_fakerton_limits.conf")
  end

  it "supports :create and :delete actions" do
    expect { resource.action :create }.not_to raise_error
    expect { resource.action :delete }.not_to raise_error
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
chef-17.4.38-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.4.38 spec/unit/resource/user_ulimit_spec.rb
chef-17.4.25-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.4.25 spec/unit/resource/user_ulimit_spec.rb
chef-16.14.1-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-16.14.1 spec/unit/resource/user_ulimit_spec.rb
chef-17.3.48-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.3.48 spec/unit/resource/user_ulimit_spec.rb
chef-17.2.29-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.2.29 spec/unit/resource/user_ulimit_spec.rb
chef-17.1.35-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.1.35 spec/unit/resource/user_ulimit_spec.rb
chef-17.0.242-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-17.0.242 spec/unit/resource/user_ulimit_spec.rb
chef-16.13.16-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-16.13.16 spec/unit/resource/user_ulimit_spec.rb
chef-16.12.3-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-16.12.3 spec/unit/resource/user_ulimit_spec.rb
chef-16.11.7-universal-mingw32 spec/unit/resource/user_ulimit_spec.rb
chef-16.11.7 spec/unit/resource/user_ulimit_spec.rb