spec/command_spec.rb in mercenary-0.3.6 vs spec/command_spec.rb in mercenary-0.4.0
- old
+ new
@@ -1,9 +1,10 @@
+# frozen_string_literal: true
+
require "spec_helper"
describe(Mercenary::Command) do
-
context "a basic command" do
let(:command) { Mercenary::Command.new(:my_name) }
let(:parent) { Mercenary::Command.new(:my_parent) }
let(:with_sub) do
c = Mercenary::Command.new(:i_have_subcommand)
@@ -15,11 +16,11 @@
:i_have_parent,
parent
)
end
let(:add_sub) do
- Proc.new do |c|
+ proc do |c|
c.command(:sub_command) { |p| }
end
end
it "can be created with just a name" do
@@ -54,11 +55,11 @@
expect(command.description).to eq(desc)
end
it "can set its options" do
name = "show_drafts"
- opts = ['--drafts', 'Render posts in the _drafts folder']
+ opts = ["--drafts", "Render posts in the _drafts folder"]
option = Mercenary::Option.new(name, opts)
command.option name, *opts
expect(command.options).to eql([option])
expect(command.map.values).to include(name)
end
@@ -66,11 +67,11 @@
it "knows its full name" do
expect(command_with_parent.full_name).to eql("my_parent i_have_parent")
end
it "knows its identity" do
- command_with_parent.version '1.8.7'
+ command_with_parent.version "1.8.7"
expect(command_with_parent.identity).to eql("my_parent i_have_parent 1.8.7")
end
it "raises an ArgumentError if I specify a default_command that isn't there" do
c = command # some weird NameError with the block below?
@@ -92,7 +93,6 @@
it "its names_and_aliases method reports both the name and alias" do
expect(command_with_parent.names_and_aliases).to eql("i_have_parent, an_alias")
end
end
end
-
end