Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Fix spec_dir lookup when Dir.pwd is not Rails.root #227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jasmine-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def route_path

def spec_dir
paths = jasmine_config['spec_dir'] || 'spec/javascripts'
[paths].flatten.map { |path| Dir.glob path }.flatten.collect { |path| Rails.root.join(path) }
[paths].flatten.map { |path| Dir.glob(Rails.root.join(path)) }.flatten.collect { |path| Rails.root.join(path) }
Copy link

@kyrofa kyrofa Apr 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[paths].flatten.map { |path| Dir.glob(Rails.root.join(path)) }.flatten.collect { |path| Rails.root.join(path) }
[paths].flatten.collect { |path| Pathname.glob Rails.root.join(path) }.flatten

That's how I fixed it, anyway. Seems a little more efficient and cleaner. And actually, I think those globs are going to include the rails root, which means trying to join it again will lead to issues, no?

Anyway, I was going to propose it, but then I saw you already tried to fix it years ago. @searls what do you think about this? I ended up proposing #240 with this just given the age.

end

def include_dir
Expand Down