Skip to content

Instantly share code, notes, and snippets.

@thbar
Created March 15, 2017 14:07
Show Gist options
  • Select an option

  • Save thbar/5c7678c94da9d081a1090b31a155e6fa to your computer and use it in GitHub Desktop.

Select an option

Save thbar/5c7678c94da9d081a1090b31a155e6fa to your computer and use it in GitHub Desktop.
Using ServerSpec to verify per-user RVM setup
def command_as(command, as:)
command(%Q{su -c #{Shellwords.escape(command)} --login #{as}})
end
%w(my_user).each do |user|
describe "RVM setup for user #{user}" do
%w(ruby-2.4.0).each do |ruby_version|
let(:subject) { command_as('rvm list strings', as: user) }
it "has #{ruby_version} installed" do
expect(subject.stdout.split("\n")).to include(ruby_version)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment