diff --git a/lib/thor/parser/options.rb b/lib/thor/parser/options.rb index 497bcbb3..5d6a6fd7 100644 --- a/lib/thor/parser/options.rb +++ b/lib/thor/parser/options.rb @@ -144,7 +144,7 @@ def parse(args) # rubocop:disable Metrics/MethodLength def check_exclusive! opts = @assigns.keys # When option A and B are exclusive, if A and B are given at the same time, - # the diffrence of argument array size will decrease. + # the difference of argument array size will decrease. found = @exclusives.find{ |ex| (ex - opts).size < ex.size - 1 } if found names = names_to_switch_names(found & opts).map{|n| "'#{n}'"} @@ -175,7 +175,7 @@ def check_unknown! protected - # Option names changes to swith name or human name + # Option names changes to switch name or human name def names_to_switch_names(names = []) @switches.map do |_, o| if names.include? o.name diff --git a/spec/parser/options_spec.rb b/spec/parser/options_spec.rb index 200a5d5f..ce1025f5 100644 --- a/spec/parser/options_spec.rb +++ b/spec/parser/options_spec.rb @@ -262,11 +262,11 @@ def remaining [["foo", "bar"], ["baz","qux"]]) end - it "raises an error if exclusive argumets are given" do + it "raises an error if exclusive arguments are given" do expect{parse(%w[--foo --bar])}.to raise_error(Thor::ExclusiveArgumentError, "Found exclusive options '--foo', '--bar'") end - it "does not raise an error if exclusive argumets are not given" do + it "does not raise an error if exclusive arguments are not given" do expect{parse(%w[--foo --baz])}.not_to raise_error end end @@ -277,7 +277,7 @@ def remaining [], [["foo", "bar"], ["baz","qux"]]) end - it "raises an error if at least one of required argumet is not given" do + it "raises an error if at least one of required argument is not given" do expect{parse(%w[--baz])}.to raise_error(Thor::AtLeastOneRequiredArgumentError, "Not found at least one of required options '--foo', '--bar'") end @@ -292,11 +292,11 @@ def remaining [["foo", "bar"], ["baz","qux"]]) end - it "raises an error if exclusive argumets are given" do + it "raises an error if exclusive arguments are given" do expect{parse(%w[--foo --bar])}.to raise_error(Thor::ExclusiveArgumentError, "Found exclusive options '--foo', '--bar'") end - it "does not raise an error if exclusive argumets are not given" do + it "does not raise an error if exclusive arguments are not given" do expect{parse(%w[--foo --baz])}.not_to raise_error end end @@ -307,7 +307,7 @@ def remaining [], [["foo", "bar"], ["baz","qux"]]) end - it "raises an error if at least one of required argumet is not given" do + it "raises an error if at least one of required argument is not given" do expect{parse(%w[--baz])}.to raise_error(Thor::AtLeastOneRequiredArgumentError, "Not found at least one of required options '--foo', '--bar'") end diff --git a/spec/thor_spec.rb b/spec/thor_spec.rb index 6d03eb41..fe15d9be 100644 --- a/spec/thor_spec.rb +++ b/spec/thor_spec.rb @@ -581,7 +581,7 @@ def shell expect(content).not_to match(/Exclusive Options:/) end - it "prints class at least one of requred options" do + it "prints class at least one of required options" do content = capture(:stdout) { MyClassOptionScript.help(shell) } expect(content).to match(/Required At Least One:\n\s+--three\s+--four\n/) end