Skip to content

Commit

Permalink
Change to ensure required argument dsl works
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Apr 8, 2020
1 parent 75f10c7 commit d955f7a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spec/unit/parse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ def new_command(&block)
expect(cmd.params[:foo]).to eq("bar")
end

it "defaults argument to be required" do
it "marks argument to be required" do
cmd = new_command do
argument :foo
argument :foo do
required
end
end

expect {
cmd.parse([])
}.to raise_error(TTY::Option::InvalidArity,
"expected argument :foo to appear 1 times " \
"but appeared 0 times")
}.to raise_error(TTY::Option::MissingParameter,
"need to provide 'foo' argument")
end

it "defauls argument to a value" do
Expand Down

0 comments on commit d955f7a

Please sign in to comment.