Skip to content

Commit

Permalink
update n8l::up2date_check() spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt authored and gcomoretto committed Mar 1, 2018
1 parent a6b6e1f commit 827d387
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions spec/unit/n8l/up2date_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

context 'script matches master' do
it 'prints nothing' do
stubbed_env.stub_command('diff').outputs('notta')
stubbed_env.stub_command('diff').returns_exitstatus(0)

out, err, status = stubbed_env.execute_function(
'scripts/newinstall.sh',
Expand All @@ -24,7 +24,7 @@

context 'script out of sync with master' do
it 'prints a non-fatal warning' do
stubbed_env.stub_command('diff').outputs('differ')
stubbed_env.stub_command('diff').returns_exitstatus(1)

out, err, status = stubbed_env.execute_function(
'scripts/newinstall.sh',
Expand All @@ -36,5 +36,21 @@
expect(out).to eq('')
expect(err).to match(/This script differs from the official version/)
end
end # script matches master
end # script out of sync with master

context 'unknown error comparing source against master' do
it 'prints a non-fatal warning' do
stubbed_env.stub_command('diff').returns_exitstatus(2)

out, err, status = stubbed_env.execute_function(
'scripts/newinstall.sh',
func,
{ 'CURL' => 'true' },
)

expect(status.exitstatus).to be 0
expect(out).to eq('')
expect(err).to match(/There is an error in comparing/)
end
end # unknown error comparing source against master
end

0 comments on commit 827d387

Please sign in to comment.