Skip to content

Commit

Permalink
fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
tompesman committed Apr 4, 2015
1 parent 3b26a9c commit 2fe713c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pushr/daemon/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def initialize
@pid_file = nil
end

def pid_file=(arg)
@pid_file = File.join(Dir.pwd, arg) if arg && !Pathname.new(arg).absolute?
def pid_file=(file)
@pid_file = Pathname.new(file).absolute? ? file : File.join(Dir.pwd, file)
end
end
end
Expand Down
22 changes: 22 additions & 0 deletions spec/lib/pushr/daemon/settings_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'spec_helper'
require 'pushr/daemon'

describe Pushr::Daemon::Settings do
describe 'log level' do
subject { Pushr::Daemon::Settings.new }

it 'returns absolute path' do
subject.pid_file = __FILE__
expect(subject.pid_file).to eql __FILE__
end

it 'returns relative path' do
subject.pid_file = 'filename.pid'
expect(subject.pid_file).to eql File.join(Dir.pwd, 'filename.pid')
end

it 'returns nil if no pid_file' do
expect(subject.pid_file).to eql nil
end
end
end

0 comments on commit 2fe713c

Please sign in to comment.