diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/shared/unit/provider/useradd_based_user_provider.rb | 10 | ||||
-rw-r--r-- | spec/unit/provider/user/linux_spec.rb | 12 |
2 files changed, 6 insertions, 16 deletions
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb index de851c4ad4..007441dc6c 100644 --- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb +++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb @@ -100,7 +100,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option it "should set useradd -r" do @new_resource.system(true) - expect(provider.useradd_options).to eq([ "-r" ]) + expect(provider.useradd_options).to eq([ "-r", "-m" ]) end end @@ -112,7 +112,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option it "should set -m -d /homedir" do expect(provider.universal_options).to eq(%w{-d /wowaweea -m}) - expect(provider.useradd_options).to eq([]) + expect(provider.useradd_options).to eq([ "-m" ]) # FIXME: repeated -m end end @@ -125,7 +125,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option it "should set -m -d /homedir" do expect(provider.universal_options).to eql(%w{-d /wowaweea -m}) - expect(provider.useradd_options).to eq([]) + expect(provider.useradd_options).to eq([ "-m" ]) # FIXME: repeated -m end end @@ -158,7 +158,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option command.concat([ "-s", "/usr/bin/zsh", "-u", "1000", "-d", "/Users/mud", - "-m", + "-m", "-m", # FIXME: repeated -m "adam" ]) expect(provider).to receive(:shell_out!).with(*command).and_return(true) provider.create_user @@ -179,7 +179,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option command.concat(["-p", "abracadabra"]) if supported_useradd_options.key?("password") command.concat([ "-s", "/usr/bin/zsh", "-u", "1000", - "-r", + "-r", "-m", "adam" ]) expect(provider).to receive(:shell_out!).with(*command).and_return(true) provider.create_user diff --git a/spec/unit/provider/user/linux_spec.rb b/spec/unit/provider/user/linux_spec.rb index ef12cec234..eb76b2672e 100644 --- a/spec/unit/provider/user/linux_spec.rb +++ b/spec/unit/provider/user/linux_spec.rb @@ -39,16 +39,6 @@ describe Chef::Provider::User::Linux do include_examples "a useradd-based user provider", supported_useradd_options - describe "manage_user" do - # CHEF-5247: Chef::Provider::User::Solaris subclasses Chef::Provider::User::Useradd, but does not use usermod to change passwords. - # Thus, a call to Solaris#manage_user calls Solaris#manage_password and Useradd#manage_user, but the latter should be a no-op. - it "should not run the command if universal_options is an empty array" do - allow(provider).to receive(:universal_options).and_return([]) - expect(provider).not_to receive(:shell_out!) - provider.manage_user - end - end - describe "manage_home behavior" do before(:each) do @new_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context) @@ -70,7 +60,7 @@ describe Chef::Provider::User::Linux do end it "by default manage_home is true and we do not -M" do - expect( provider.useradd_options ).to eql([]) + expect( provider.useradd_options ).to eql(["-m"]) end it "setting manage_home to false includes -M" do |