Created
March 15, 2017 14:07
-
-
Save thbar/5c7678c94da9d081a1090b31a155e6fa to your computer and use it in GitHub Desktop.
Using ServerSpec to verify per-user RVM setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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