-
-
Save failshell/f78e4a5432851e22a472 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
require 'serverspec' | |
class Foo | |
include Serverspec | |
def command(cmd) | |
self.class.command(cmd) | |
end | |
def user(user) | |
self.class.user(user) | |
end | |
def self.command(cmd) | |
describe 'command' do | |
it "command: #{cmd}" do | |
expect((command cmd).exit_status).to eq 0 | |
end | |
end | |
end | |
def self.user(user) | |
describe 'user' do | |
it 'user' do | |
expect(user user).to exist | |
end | |
end | |
end | |
end | |
set :backend, :exec | |
f = Foo.new | |
f.command('ls') | |
f.command('ls /tmp') | |
f.user('rooot') |
This file contains 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
#!/usr/bin/env ruby | |
require 'serverspec' | |
class Foo | |
def command(cmd) | |
Serverspec.describe 'command' do | |
it "command: #{cmd}" do | |
expect((command cmd).exit_status).to eq 0 | |
end | |
end | |
end | |
def user(user) | |
Serverspec.describe 'user' do | |
it 'user' do | |
expect(user user).to exist | |
end | |
end | |
end | |
end | |
set :backend, :exec | |
f = Foo.new | |
f.command('ls') | |
f.command('ls /tmp') | |
f.user('rooot') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment