Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit b315f1a

Browse files
committed
Update path_to_executable spec so it doesn't simply mirror implementation.
- Verify the file exists. - Verify it's an executable.
1 parent 20c5d26 commit b315f1a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/rspec/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class << self
139139

140140
# @private path to executable file
141141
def self.path_to_executable
142-
File.expand_path('../../../exe/rspec', __FILE__)
142+
@path_to_executable ||= File.expand_path('../../../exe/rspec', __FILE__)
143143
end
144144

145145
end

spec/rspec/core_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555

5656
describe "::Core.path_to_executable" do
5757
it 'returns the absolute location of the exe/rspec file' do
58-
expect(RSpec::Core.path_to_executable).to eq File.expand_path('../../../exe/rspec',__FILE__)
58+
expect(File.exist? RSpec::Core.path_to_executable).to be_true
59+
expect(File.executable? RSpec::Core.path_to_executable).to be_true
5960
end
6061
end
6162
end
63+

0 commit comments

Comments
 (0)