diff --git a/lib/pronto/reek.rb b/lib/pronto/reek.rb index a0dcb7c..977188e 100644 --- a/lib/pronto/reek.rb +++ b/lib/pronto/reek.rb @@ -4,7 +4,10 @@ module Pronto class Reek < Runner def run - files = ruby_patches.map(&:new_file_full_path) + files = ruby_patches.map do |patch| + patch.new_file_full_path.relative_path_from(Pathname.pwd) + end + configuration = ::Reek::Configuration::AppConfiguration.from_path(nil) smells = files.flat_map do |file| @@ -37,7 +40,7 @@ def new_message(line, error) def patch_for_error(error) ruby_patches.find do |patch| - patch.new_file_full_path.to_s == error.source + patch.new_file_full_path.relative_path_from(Pathname.pwd).to_s == error.source end end end diff --git a/spec/pronto/reek_spec.rb b/spec/pronto/reek_spec.rb index bac59d4..d06126a 100644 --- a/spec/pronto/reek_spec.rb +++ b/spec/pronto/reek_spec.rb @@ -36,8 +36,8 @@ module Pronto context 'patches with additions to non-ruby files' do let(:examiner) { double('examiner', smells: []) } - let(:ruby_file) { Pathname.new('ruby_code.rb') } - let(:other_file) { Pathname.new('other.stuff') } + let(:ruby_file) { Pathname.pwd.join('ruby_code.rb') } + let(:other_file) { Pathname.pwd.join('other.stuff') } before { ::Reek::Examiner.stub(:new).and_return(examiner) } let(:patches) do @@ -51,7 +51,7 @@ module Pronto it 'calls reek with only the ruby files' do subject - ::Reek::Examiner.should have_received(:new).with(ruby_file, hash_including(:configuration)) + ::Reek::Examiner.should have_received(:new).with(Pathname('ruby_code.rb'), hash_including(:configuration)) ::Reek::Examiner.should_not have_received(:new).with other_file end end