Skip to content

Commit

Permalink
Merge pull request #12 from martinandert/fix-from_filename-not-forwar…
Browse files Browse the repository at this point in the history
…ding-type-arg

Fix #from_filename not forwarding type arg
  • Loading branch information
highb committed Aug 23, 2017
2 parents 949fed7 + 9aeaefc commit 60a4c02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pathspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def drive_letter_to_path(path)

# Generate specs from a filename, such as a .gitignore
def self.from_filename(filename, type=:git)
self.from_lines(File.open(filename, 'r'))
self.from_lines(File.open(filename, 'r'), type)
end

def self.from_lines(lines, type=:git)
Expand Down
9 changes: 9 additions & 0 deletions spec/unit/pathspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@
expect(subject.match('anna')).to be false
expect(subject.match('abba')).to be true
end

context "#from_filename" do
it "forwards the type argument" do
expect(File).to receive(:open).and_return(anything)
expect(PathSpec).to receive(:from_lines).with(anything, :regex)

PathSpec.from_filename "/some/file", :regex
end
end
end

context "unsuppored spec type" do
Expand Down

0 comments on commit 60a4c02

Please sign in to comment.