describe "The -n, --name RUBY_NAME option" do
before :each do
@verbose, $VERBOSE = $VERBOSE, nil
@options = new_option
end
after :each do
$VERBOSE = @verbose
end
it "is enabled with #add_name" do
@options.should_receive(:on).with("-n", "--name RUBY_NAME", :anything, :string)
@options.add_name
end
it "sets RUBY_NAME when invoked" do
Object.should_receive(:const_set).with(:RUBY_NAME, "name").twice
@options.add_name
@options.parse ["-n", "name"]
@options.parse ["--name", "name"]
end
end
describe MSpecOptions, "#add_targets" do
before :each do
@options = MSpecOptions.new MOSConfig.new, "spec"
@options.add_targets
end
it "adds -t, --target TARGET option" do
@options.parse ["-t", "ruby"]
@options.parse ["--target", "ruby"]
end
it "adds -T, --target-opt OPT option" do
@options.parse ["-T", "--ps"]
@options.parse ["--target-opt", "--ps"]
end
it "adds -I, --include DIR option" do
@options.parse ["-I", "include"]
@options.parse ["--include", "include"]
end
it "adds -r, --require LIBRARY option" do
@options.parse ["-r", "library"]
@options.parse ["--require", "library"]
end
end