summaryrefslogtreecommitdiff
path: root/spec/unit/mixin/homebrew_user_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/mixin/homebrew_user_spec.rb')
-rw-r--r--spec/unit/mixin/homebrew_user_spec.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/unit/mixin/homebrew_user_spec.rb b/spec/unit/mixin/homebrew_user_spec.rb
index 57b89720dc..77e37a030c 100644
--- a/spec/unit/mixin/homebrew_user_spec.rb
+++ b/spec/unit/mixin/homebrew_user_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/mixin/homebrew_user'
+require "spec_helper"
+require "chef/mixin/homebrew_user"
class ExampleHomebrewUser
include Chef::Mixin::HomebrewUser
@@ -24,22 +24,22 @@ end
describe Chef::Mixin::HomebrewUser do
before(:each) do
- node.default['homebrew']['owner'] = nil
+ node.default["homebrew"]["owner"] = nil
end
let(:homebrew_user) { ExampleHomebrewUser.new }
let(:node) { Chef::Node.new }
- describe 'when the homebrew user is provided' do
+ describe "when the homebrew user is provided" do
let(:uid) { 1001 }
let(:user) { "foo" }
- it 'returns the homebrew user without looking at the file when uid is provided' do
+ it "returns the homebrew user without looking at the file when uid is provided" do
expect(File).to receive(:exist?).exactly(0).times
expect(homebrew_user.find_homebrew_uid(uid)).to eq(uid)
end
- it 'returns the homebrew user without looking at the file when name is provided' do
+ it "returns the homebrew user without looking at the file when name is provided" do
expect(File).to receive(:exist?).exactly(0).times
allow(Etc).to receive_message_chain(:getpwnam, :uid).and_return(uid)
expect(homebrew_user.find_homebrew_uid(user)).to eq(uid)
@@ -50,7 +50,7 @@ describe Chef::Mixin::HomebrewUser do
shared_examples "successfully find executable" do
let(:user) { nil }
let(:brew_owner) { 2001 }
- let(:default_brew_path) { '/usr/local/bin/brew' }
+ let(:default_brew_path) { "/usr/local/bin/brew" }
let(:stat_double) {
d = double()
expect(d).to receive(:uid).and_return(brew_owner)
@@ -63,13 +63,13 @@ describe Chef::Mixin::HomebrewUser do
expect(Etc).to receive(:getpwuid).with(brew_owner).and_return(OpenStruct.new(:name => "name"))
end
- it 'returns the owner of the brew executable when it is at a default location' do
+ it "returns the owner of the brew executable when it is at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(true)
expect(File).to receive(:stat).with(default_brew_path).and_return(stat_double)
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
end
- it 'returns the owner of the brew executable when it is not at a default location' do
+ it "returns the owner of the brew executable when it is not at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("/foo")
expect(File).to receive(:stat).with("/foo").and_return(stat_double)
@@ -79,9 +79,9 @@ describe Chef::Mixin::HomebrewUser do
end
end
- describe 'when the homebrew user is not provided' do
+ describe "when the homebrew user is not provided" do
- it 'raises an error if no executable is found' do
+ it "raises an error if no executable is found" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("")
expect { homebrew_user.find_homebrew_uid(user) }.to raise_error(Chef::Exceptions::CannotDetermineHomebrewOwner)