diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:29:13 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-07-02 10:29:13 -0700 |
commit | 878560a22f37aec0c2dfe681b3743e027155be88 (patch) | |
tree | 676062be70a45e73a8722c0e6dadd220162fb101 /spec/support | |
parent | 202887162a22e0c7062064fff0d9462f8c02bf0e (diff) | |
download | chef-878560a22f37aec0c2dfe681b3743e027155be88.tar.gz |
fix Layout/DotPosition
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared/context/client.rb | 32 | ||||
-rw-r--r-- | spec/support/shared/unit/provider/useradd_based_user_provider.rb | 36 |
2 files changed, 34 insertions, 34 deletions
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb index 6797a4ad22..0054058d0f 100644 --- a/spec/support/shared/context/client.rb +++ b/spec/support/shared/context/client.rb @@ -87,10 +87,10 @@ shared_context "a client run" do # Make sure Client#register thinks the client key doesn't # exist, so it tries to register and create one. allow(File).to receive(:exists?).and_call_original - expect(File).to receive(:exists?). - with(Chef::Config[:client_key]). - exactly(:once). - and_return(api_client_exists?) + expect(File).to receive(:exists?) + .with(Chef::Config[:client_key]) + .exactly(:once) + .and_return(api_client_exists?) unless api_client_exists? # Client.register will register with the validation client name. @@ -99,21 +99,21 @@ shared_context "a client run" do end def stub_for_data_collector_init - expect(Chef::ServerAPI).to receive(:new). - with(Chef::Config[:data_collector][:server_url], validate_utf8: false). - exactly(:once). - and_return(http_data_collector) + expect(Chef::ServerAPI).to receive(:new) + .with(Chef::Config[:data_collector][:server_url], validate_utf8: false) + .exactly(:once) + .and_return(http_data_collector) end def stub_for_node_load # Client.register will then turn around create another # Chef::ServerAPI object, this time with the client key it got from the # previous step. - expect(Chef::ServerAPI).to receive(:new). - with(Chef::Config[:chef_server_url], client_name: fqdn, - signing_key_filename: Chef::Config[:client_key]). - exactly(:once). - and_return(http_node_load) + expect(Chef::ServerAPI).to receive(:new) + .with(Chef::Config[:chef_server_url], client_name: fqdn, + signing_key_filename: Chef::Config[:client_key]) + .exactly(:once) + .and_return(http_node_load) # --Client#build_node # looks up the node, which we will return, then later saves it. @@ -135,9 +135,9 @@ shared_context "a client run" do # expect_any_instance_of(Chef::CookbookSynchronizer).to receive(:sync_cookbooks) expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url], version_class: Chef::CookbookManifestVersions).and_return(http_cookbook_sync) - expect(http_cookbook_sync).to receive(:post). - with("environments/_default/cookbook_versions", { run_list: [] }). - and_return({}) + expect(http_cookbook_sync).to receive(:post) + .with("environments/_default/cookbook_versions", { run_list: [] }) + .and_return({}) end def stub_for_required_recipe 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 a6301f9ae7..3e48cdf92d 100644 --- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb +++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb @@ -272,51 +272,51 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option end it "should return false if status begins with P" do - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_s_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_s_status) expect(provider.check_lock).to eql(false) end it "should return false if status begins with N" do @stdout = "root N" - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_s_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_s_status) expect(provider.check_lock).to eql(false) end it "should return true if status begins with L" do @stdout = "root L" - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_s_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_s_status) expect(provider.check_lock).to eql(true) end it "should raise a ShellCommandFailed exception if passwd -S exits with something other than 0 or 1" do expect(passwd_s_status).to receive(:error!).and_raise(Mixlib::ShellOut::ShellCommandFailed) - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_s_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_s_status) expect { provider.check_lock }.to raise_error(Mixlib::ShellOut::ShellCommandFailed) end it "should raise an error if the output isn't parsable" do expect(passwd_s_status).to receive(:stdout).and_return("") expect(passwd_s_status).to receive(:stderr).and_return("") - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_s_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_s_status) expect { provider.check_lock }.to raise_error(Chef::Exceptions::User) end context "when in why run mode" do before do passwd_status = double("Mixlib::ShellOut command", exitstatus: 0, stdout: "", stderr: "passwd: user 'chef-test' does not exist\n") - expect(provider).to receive(:shell_out). - with("passwd", "-S", @new_resource.username, { returns: [0, 1] }). - and_return(passwd_status) + expect(provider).to receive(:shell_out) + .with("passwd", "-S", @new_resource.username, { returns: [0, 1] }) + .and_return(passwd_status) # ubuntu returns 252 on user-does-not-exist so will raise if #error! is called or if # shell_out! is used allow(passwd_status).to receive(:error!).and_raise(Mixlib::ShellOut::ShellCommandFailed) |