Skip to content

Commit

Permalink
Change to consistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Mar 24, 2020
1 parent 72ee16f commit a1657ab
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/unit/parser/arguments_spec.rb
Expand Up @@ -11,16 +11,16 @@ def parse(argv, args, **config)
end

it "parses one argument by default" do
opts,rest = parse(%w[a], arg(:foo))
params, rest = parse(%w[a], arg(:foo))

expect(opts[:foo]).to eq("a")
expect(params[:foo]).to eq("a")
expect(rest).to eq([])
end

it "parses exactly 2 arguments and leaves the rest" do
opts,rest = parse(%w[a b c], arg(:foo, arity: 2))
params, rest = parse(%w[a b c], arg(:foo, arity: 2))

expect(opts[:foo]).to eq(%w[a b])
expect(params[:foo]).to eq(%w[a b])
expect(rest).to eq(%w[c])
end

Expand All @@ -45,9 +45,9 @@ def parse(argv, args, **config)
end

it "parses zero or more arguments" do
opts,rest = parse(%w[a b c], arg(:foo, arity: "*"))
params, rest = parse(%w[a b c], arg(:foo, arity: "*"))

expect(opts[:foo]).to eq(%w[a b c])
expect(params[:foo]).to eq(%w[a b c])
expect(rest).to eq([])
end

Expand Down Expand Up @@ -81,16 +81,16 @@ def parse(argv, args, **config)

context "when :default" do
it "parses no arguments and has default value" do
opts,rest = parse([], arg(:foo, arity: 2, default: %w[a b]))
params, rest = parse([], arg(:foo, arity: 2, default: %w[a b]))

expect(opts[:foo]).to eq(%w[a b])
expect(params[:foo]).to eq(%w[a b])
expect(rest).to eq([])
end

it "parses no arguments and has proc default" do
opts,rest = parse([], arg(:foo, arity: 2, default: -> { %w[a b] }))
params, rest = parse([], arg(:foo, arity: 2, default: -> { %w[a b] }))

expect(opts[:foo]).to eq(%w[a b])
expect(params[:foo]).to eq(%w[a b])
expect(rest).to eq([])
end
end
Expand Down

0 comments on commit a1657ab

Please sign in to comment.