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

Fix when tmux is not installed or is not found again. #38

Merged
merged 1 commit into from
Aug 1, 2019
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 lib/notiffany/notifier/tmux/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class << self
def version
begin
Float(_capture("-V")[/\d+\.\d+/])
rescue TypeError
rescue NoMethodError, TypeError
rymai marked this conversation as resolved.
Show resolved Hide resolved
raise Base::UnavailableError, "Could not find tmux"
end
end
Expand Down
11 changes: 10 additions & 1 deletion spec/lib/notiffany/notifier/tmux_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ class Notifier
describe ".version" do
context "when tmux is not installed" do
it "fails" do
allow(sheller).to receive(:stdout).and_return('')
allow(sheller).to receive(:stdout).and_return(nil)
expect do
described_class.version
end.to raise_error(Base::UnavailableError)
end
end

context "when 'tmux -v' doesn't contain float-like string" do
it "fails" do
allow(sheller).to receive(:stdout).and_return('master')
expect do
described_class.version
end.to raise_error(Base::UnavailableError)
Expand Down