Skip to content

Commit

Permalink
Merge pull request #38 from eitoball/fix-when-tmux-not-installed-again
Browse files Browse the repository at this point in the history
Fix when tmux is not installed or is not found again.
  • Loading branch information
rymai committed Aug 1, 2019
2 parents caf272c + d21d36f commit 5ed9091
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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
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

0 comments on commit 5ed9091

Please sign in to comment.