summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-13 08:24:54 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-13 08:24:54 -0500
commitaa0b8e7cd9402d63ddb8ebee14198d448fb488c7 (patch)
tree8642eacac61d809bdd2f1bab9813da6385bfcd7a /tests
parent9d1fa0723fc5a68c92db67c73013dfa6ad38b890 (diff)
downloadhorizon-aa0b8e7cd9402d63ddb8ebee14198d448fb488c7.tar.gz
horizon-aa0b8e7cd9402d63ddb8ebee14198d448fb488c7.tar.bz2
horizon-aa0b8e7cd9402d63ddb8ebee14198d448fb488c7.tar.xz
horizon-aa0b8e7cd9402d63ddb8ebee14198d448fb488c7.zip
tests: Add simulator tests
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/simulator.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/spec/simulator.rb b/tests/spec/simulator.rb
new file mode 100644
index 0000000..7919647
--- /dev/null
+++ b/tests/spec/simulator.rb
@@ -0,0 +1,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