Skip to content

Commit

Permalink
commented out spec until we (possibly) re-add command line arguments …
Browse files Browse the repository at this point in the history
…later on
  • Loading branch information
auxesis committed Nov 25, 2009
1 parent 845fadc commit 955c39e
Showing 1 changed file with 115 additions and 113 deletions.
228 changes: 115 additions & 113 deletions spec/notifier_options_spec.rb
Original file line number Diff line number Diff line change
@@ -1,113 +1,115 @@
require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'cli', 'notifier')

describe Flapjack::Notifier::Options do

# beanstalk
it "should accept the location of a beanstalk queue in short form" do
args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.host.should == "localhost"
end

it "should accept the location of a beanstalk queue in long form" do
args = %w(--beanstalk localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.host.should == "localhost"
end

it "should set a default beanstalk host" do
args = %w(-r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.host.should == 'localhost'
end

# beanstalk port
it "should accept a specified beanstalk port in short form" do
args = %w(-b localhost -p 11340 -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.port.should == 11340
end

it "should accept a specified beanstalk port in long form" do
args = %w(-b localhost --port 11399 -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.port.should == 11399
end

it "should set a default beanstalk port" do
args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.port.should == 11300
end

# recipients
it "should accept the location of a recipients file in short form" do
args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.recipients.should == "spec/recipients.yaml"
end

it "should accept the location of a recipients file in long form" do
args = %w(-b localhost --recipient spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.recipients.should == "spec/recipients.yaml"
end

it "should exit if the recipients file doesn't exist" do
args = %w(-b localhost -r spec/wangity.yaml -c spec/flapjack-notifier.yaml)
lambda {
Flapjack::Notifier::Options.parse(args)
}.should raise_error(SystemExit)
end

it "should exit if the recipients file isn't specified" do
args = %w(-b localhost -c spec/flapjack-notifier.yaml)
lambda {
Flapjack::Notifier::Options.parse(args)
}.should raise_error(SystemExit)
end

# config
it "should accept the location of a config file in short form" do
args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.config_filename.should == "spec/flapjack-notifier.yaml"
end

it "should accept the location of a config file in long form" do
args = %w(-b localhost -r spec/recipients.yaml --config spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.config_filename.should == "spec/flapjack-notifier.yaml"
end

it "should provide a default config file if not specified" do
args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
options = Flapjack::Notifier::Options.parse(args)
options.config_filename.should_not be_nil
end

it "should exit if the config file doesn't exist" do
args = %w(-b localhost --config spec/wangity.yaml)
lambda {
Flapjack::Notifier::Options.parse(args)
}.should raise_error(SystemExit)
end

# general
it "should exit when asked for help in short form" do
args = %w(-h)
lambda {
Flapjack::Notifier::Options.parse(args)
}.should raise_error(SystemExit)
end

it "should exit when asked for help in long form" do
args = %w(--help)
lambda {
Flapjack::Notifier::Options.parse(args)
}.should raise_error(SystemExit)
end
end


def puts(*args) ; end
##!/usr/bin/env ruby
##
#require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'cli', 'notifier')
#
#describe Flapjack::Notifier::Options do
#
# # beanstalk
# it "should accept the location of a beanstalk queue in short form" do
# args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.host.should == "localhost"
# end
#
# it "should accept the location of a beanstalk queue in long form" do
# args = %w(--beanstalk localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.host.should == "localhost"
# end
#
# it "should set a default beanstalk host" do
# args = %w(-r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.host.should == 'localhost'
# end
#
# # beanstalk port
# it "should accept a specified beanstalk port in short form" do
# args = %w(-b localhost -p 11340 -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.port.should == 11340
# end
#
# it "should accept a specified beanstalk port in long form" do
# args = %w(-b localhost --port 11399 -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.port.should == 11399
# end
#
# it "should set a default beanstalk port" do
# args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.port.should == 11300
# end
#
# # recipients
# it "should accept the location of a recipients file in short form" do
# args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.recipients.should == "spec/recipients.yaml"
# end
#
# it "should accept the location of a recipients file in long form" do
# args = %w(-b localhost --recipient spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.recipients.should == "spec/recipients.yaml"
# end
#
# it "should exit if the recipients file doesn't exist" do
# args = %w(-b localhost -r spec/wangity.yaml -c spec/flapjack-notifier.yaml)
# lambda {
# Flapjack::Notifier::Options.parse(args)
# }.should raise_error(SystemExit)
# end
#
# it "should exit if the recipients file isn't specified" do
# args = %w(-b localhost -c spec/flapjack-notifier.yaml)
# lambda {
# Flapjack::Notifier::Options.parse(args)
# }.should raise_error(SystemExit)
# end
#
# # config
# it "should accept the location of a config file in short form" do
# args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.config_filename.should == "spec/flapjack-notifier.yaml"
# end
#
# it "should accept the location of a config file in long form" do
# args = %w(-b localhost -r spec/recipients.yaml --config spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.config_filename.should == "spec/flapjack-notifier.yaml"
# end
#
# it "should provide a default config file if not specified" do
# args = %w(-b localhost -r spec/recipients.yaml -c spec/flapjack-notifier.yaml)
# options = Flapjack::Notifier::Options.parse(args)
# options.config_filename.should_not be_nil
# end
#
# it "should exit if the config file doesn't exist" do
# args = %w(-b localhost --config spec/wangity.yaml)
# lambda {
# Flapjack::Notifier::Options.parse(args)
# }.should raise_error(SystemExit)
# end
#
# # general
# it "should exit when asked for help in short form" do
# args = %w(-h)
# lambda {
# Flapjack::Notifier::Options.parse(args)
# }.should raise_error(SystemExit)
# end
#
# it "should exit when asked for help in long form" do
# args = %w(--help)
# lambda {
# Flapjack::Notifier::Options.parse(args)
# }.should raise_error(SystemExit)
# end
#end
#
#
#def puts(*args) ; end

0 comments on commit 955c39e

Please sign in to comment.