From f9c5732721d179ab682d08faa9d30d6b711957bf Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 17 May 2020 03:16:23 -0500 Subject: tests: Add --version tests, fix required installfile tests --- tests/spec/simulator_spec.rb | 26 +++++++++++++++----------- tests/spec/validator_spec.rb | 6 +++++- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb index 60e0186..ab77782 100644 --- a/tests/spec/simulator_spec.rb +++ b/tests/spec/simulator_spec.rb @@ -8,12 +8,16 @@ 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(/Allowed options/) + expect(last_command_started).to have_output(/must specify an installfile/) end it "supports Strict Mode" do run_command 'hscript-simulate foo -s' expect(last_command_started).to_not have_output(/Allowed options/) end + it "supports version output" do + run_command 'hscript-simulate --version' + expect(last_command_started).to_not have_output(/Allowed options/) + end it "doesn't output ANSI colours when instructed not to" do run_command 'hscript-simulate foo -n' expect(last_command_started).to_not have_output(/\033/) @@ -213,16 +217,16 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >> run_simulate expect(last_command_started.stdout).to include("ln -s /etc/init.d/net.lo /target/etc/init.d/net.eth0") end - it "configures IPv4 addressing correctly with eni" do - use_fixture '0227-netconfigtype-eni.installfile' - run_simulate - expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static") - end - it "configures IPv6 SLAAC addressing correctly with eni" do - use_fixture '0227-netconfigtype-eni.installfile' - run_simulate - expect(last_command_started.stdout).to include("iface eth0 inet6 manual") - end + it "configures IPv4 addressing correctly with eni" do + use_fixture '0227-netconfigtype-eni.installfile' + run_simulate + expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static") + end + it "configures IPv6 SLAAC addressing correctly with eni" do + use_fixture '0227-netconfigtype-eni.installfile' + run_simulate + expect(last_command_started.stdout).to include("iface eth0 inet6 manual") + end end context "simulating 'nameserver' execution" do it "configures nameservers correctly" do diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index 963eecf..365a8f3 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -11,7 +11,11 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do context "Utility argument passing" do it "requires an installfile to be specified" do run_command 'hscript-validate' - expect(last_command_started).to have_output(/Allowed options/) + expect(last_command_started).to have_output(/must specify an installfile/) + end + it "supports version output" do + run_command 'hscript-validate --version' + expect(last_command_started).to_not have_output(/Allowed options/) end it "accepts -i flag" do run_command 'hscript-validate foo -i' -- cgit v1.2.3-60-g2f50