Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent stdout output in tests #687

Merged
merged 3 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-c --order rand -t ~ssh
-c --order rand
2 changes: 1 addition & 1 deletion spec/lib/mina/commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
end

describe '#run' do
it 'calls run on a backend' do
it 'calls run on a backend', :suppressed_output do
commands.command('ls -al')
runner = double(:runner)
allow(Mina::Runner).to receive(:new).and_return(runner)
Expand Down
1 change: 1 addition & 0 deletions spec/lib/mina/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

it 'raises an error if key is not set' do
expect { config.ensure!(:key) }.to raise_error(SystemExit)
.and output(/key must be defined!/).to_stdout
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/tasks/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

it 'exits if no command given' do
expect { subject.invoke }.to raise_error(SystemExit)
.and output(/You need to provide a command/).to_stdout
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/tasks/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

it 'doesnt create deploy rb if already exists' do
allow(File).to receive(:exist?).and_return(false)
expect { subject.invoke }.to raise_error(SystemExit)
expect { subject.invoke }.to raise_error(SystemExit).and output(/You already have/).to_stdout
end
end