blob: 791964725a828b1b4eea86f577538af46eeec56b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require 'aruba/rspec'
IFILE_PATH = 'installfile'
def run_simulate(extra = '')
run_command 'hscript-simulate ' + IFILE_PATH + extra
end
def use_fixture(fixture)
copy '%/' + fixture, IFILE_PATH
end
RSpec.describe 'HorizonScript Simulator', :type => :aruba do
context "argument passing" do
it "requires an installfile to be specified" do
run_command 'hscript-simulate'
expect(last_command_started).to have_output(/usage/)
end
it "doesn't output ANSI colours when redirected" do
run_command 'hscript-simulate foo 2>/dev/null'
expect(last_command_started).to_not have_output(/\033/)
end
it "outputs the hashbang when redirected" do
run_command 'hscript-simulate foo'
expect(last_command_started.stdout).to start_with("#!/bin/sh")
end
end
context "simulating 'mount' flags" do
it "mounts directories in tree order" do
use_fixture '0057-many-mounts.installfile'
run_simulate
expect(last_command_started.stdout).to include("
mount /dev/sda1 /target/
mount /dev/gwyn/home /target/home
mount /dev/sda2 /target/usr
mount /dev/gwyn/source /target/usr/src")
end
end
end
|