Skip to content

Instantly share code, notes, and snippets.

@failshell
Created November 24, 2014 16:12
Show Gist options
  • Save failshell/f78e4a5432851e22a472 to your computer and use it in GitHub Desktop.
Save failshell/f78e4a5432851e22a472 to your computer and use it in GitHub Desktop.
#!/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')
#!/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