Merge pull request #15 from robbavey/master

Avoid using Pathname to compute relative paths in spout - fix merge regression
This commit is contained in:
R. Tyler Croy 2015-08-31 14:14:49 -07:00
commit 8601031c71
3 changed files with 14 additions and 1 deletions

View File

@ -162,7 +162,7 @@ module RedStorm
# below non-dry see Bolt class
def self.inherited(subclass)
path = (caller.first.to_s =~ /^(.+):\d+.*$/) ? $1 : raise(SpoutError, "unable to extract base topology class path from #{caller.first.inspect}")
subclass.base_class_path = Pathname.new(path).relative_path_from(Pathname.new(RedStorm::BASE_PATH)).to_s
subclass.base_class_path = File.expand_path(path)
end
def self.base_class_path=(path)

View File

@ -900,5 +900,11 @@ describe RedStorm::SimpleBolt do
end
end
describe 'inherited' do
it 'should calculate base class path correctly' do
expect(File).to receive(:expand_path).with(__FILE__)
class TestBolt < RedStorm::SimpleBolt; end
end
end
end
end

View File

@ -895,5 +895,12 @@ describe RedStorm::SimpleSpout do
spout.get_component_configuration.should be_instance_of(Backtype::Config)
end
end
describe 'inherited' do
it 'should calculate base class path correctly' do
expect(File).to receive(:expand_path).with(__FILE__)
class TestSpout < RedStorm::SimpleSpout; end
end
end
end
end