Skip to content

Commit

Permalink
don't silently ignore invalid lines in .reapack-index.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
cfillion committed Sep 17, 2017
1 parent 162b904 commit 4661f1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/reapack/index/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def read_config

opts = Shellwords.split File.read(path)
@opts = parse_options(opts, dir).merge @opts
raise ArgumentError, "invalid option: #{opts.first}" unless opts.empty?
}
rescue ArgumentError => e
raise ReaPack::Index::Error, e.message
Expand Down
10 changes: 10 additions & 0 deletions test/test_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ def test_config_line_break
end
end

def test_config_garbage
assert_output '', /invalid option: not$/ do
catch :stop do
wrapper [], setup: proc {
mkfile '.reapack-index.conf', "not an option"
}
end
end
end

def test_working_directory_with_options
wrapper do
@git.create_commit 'initial commit',
Expand Down

0 comments on commit 4661f1b

Please sign in to comment.