Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Fixed specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Jul 14, 2013
1 parent 789b805 commit cbc55cb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/mamertes/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module ClassMethods
def smart_join(array, separator = ", ", last_separator = " and ", quote = "\"")
separator = separator.ensure_string
last_separator = last_separator.ensure_string
array = array.dup.ensure_array {|a| quote.present? ? "#{quote}#{a}#{quote}" : a.ensure_string }
array = array.ensure_array {|a| quote.present? ? "#{quote}#{a}#{quote}" : a.ensure_string }
array.length < 2 ? (array[0] || "") : (array[0, array.length - 1].join(separator) + last_separator + array[-1])
end

Expand Down
2 changes: 1 addition & 1 deletion mamertes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |gem|

gem.required_ruby_version = ">= 1.9.3"

gem.add_dependency("bovem", "~> 2.3.4")
gem.add_dependency("bovem", "~> 2.3.6")
end


Expand Down
4 changes: 2 additions & 2 deletions spec/mamertes/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

describe "#help_option" do
it "should add a command and a option" do
application.should_receive(:command).with(:help, {:description=>"Shows a help about a command."})
application.should_receive(:option).with(:help, ["-h", "--help"], {:help=>"Shows this message."})
application.should_receive(:command).with(:help, {description: "Shows a help about a command."})
application.should_receive(:option).with(:help, ["-h", "--help"], {help: "Shows this message."})
application.help_option
end

Expand Down
8 changes: 4 additions & 4 deletions spec/mamertes/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
Kernel.stub(:exit).and_return(0)

application.console.should_receive(:write).with("[NAME]")
application.console.should_receive(:write).at_least(0)
application.console.should_receive(:write).at_least(1)
application.show_help
end

Expand All @@ -456,7 +456,7 @@

command.banner = "BANNER"
application.console.should_receive(:write).with("[DESCRIPTION]")
application.console.should_receive(:write).at_least(0)
application.console.should_receive(:write).at_least(1)
command.show_help
end

Expand All @@ -468,7 +468,7 @@

application.console.should_receive(:write).with("[GLOBAL OPTIONS]")
application.console.should_receive(:write).with("[OPTIONS]")
application.console.should_receive(:write).at_least(0)
application.console.should_receive(:write).at_least(1)
application.show_help
command.show_help
end
Expand All @@ -479,7 +479,7 @@
command.command("subcommand")
application.console.should_receive(:write).with("[COMMANDS]")
application.console.should_receive(:write).with("[SUBCOMMANDS]")
application.console.should_receive(:write).at_least(0)
application.console.should_receive(:write).at_least(1)
application.show_help
command.show_help
end
Expand Down
4 changes: 2 additions & 2 deletions spec/mamertes/option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
describe "#execute_action" do
it "should execute action if provided" do
check = false
option = ::Mamertes::Option.new("NAME") { |a,b| check = true }
option = ::Mamertes::Option.new("NAME") { |_, _| check = true }
option.execute_action

expect(check).to be_true
Expand All @@ -216,7 +216,7 @@
option.execute_action
expect(option.provided?).to be_false

option = ::Mamertes::Option.new("NAME") { check = true }
option = ::Mamertes::Option.new("NAME")
expect(option.provided?).to be_false
end
end
Expand Down
4 changes: 1 addition & 3 deletions spec/mamertes/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
::Mamertes::Application.new do
command :abc do
action do
check = 1
end

command :def do
action do |command|
check = 2
end
end
end
Expand All @@ -28,7 +26,7 @@
option :array, ["a", "array"], type: Array, help: "ARRAY"
option :choice, ["c", "choice"], type: String, help: "ARRAY", validator: ["yes", "no"]
option :regexp, ["r", "regexp"], type: String, help: "REGEXP", validator: /yes|no/i
option :action, ["A"] do |option, command|
option :action, ["A"] do |_, command|
p "[OPTION] BLOCK"
end
end
Expand Down

0 comments on commit cbc55cb

Please sign in to comment.