Skip to content

Commit

Permalink
Fix load path search.
Browse files Browse the repository at this point in the history
It worked fine before with a local bundler path, but not
a :git path -- the :git path includes the SHA in the
directory.
  • Loading branch information
myronmarston committed Aug 23, 2013
1 parent 6e2618e commit a08e7bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/rspec/expectations_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module RSpec
describe Expectations do
def file_contents_for(lib, filename)
path = $LOAD_PATH.find { |p| p.include?("/#{lib}/lib") }
# http://rubular.com/r/HYpUMftlG2
path = $LOAD_PATH.find { |p| p.match(/\/rspec-#{lib}(-[a-f0-9]+)?\/lib/) }
file = File.join(path, filename)
File.read(file)
end

it 'has an up-to-date rspec/caller_filter file' do
expectations = file_contents_for("rspec-expectations", "rspec/caller_filter.rb")
core = file_contents_for("rspec-core", "rspec/caller_filter.rb")
expectations = file_contents_for("expectations", "rspec/caller_filter.rb")
core = file_contents_for("core", "rspec/caller_filter.rb")

expect(expectations).to eq(core)
end
Expand Down

0 comments on commit a08e7bc

Please sign in to comment.