From 684f9b60fc6ffcc028081304de9c70cae793095f Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Thu, 2 Jun 2016 21:35:11 +0200 Subject: fix tests --- spec/input/ssh_spec.rb | 1 + spec/node_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/input/ssh_spec.rb b/spec/input/ssh_spec.rb index c4210f2..2550d5c 100644 --- a/spec/input/ssh_spec.rb +++ b/spec/input/ssh_spec.rb @@ -4,6 +4,7 @@ require 'oxidized/input/ssh' describe Oxidized::SSH do before(:each) do Oxidized.asetus = Asetus.new + Oxidized.setup_logger Oxidized::Node.any_instance.stubs(:resolve_input) Oxidized::Node.any_instance.stubs(:resolve_output) @node = Oxidized::Node.new(name: 'example.com', diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 21c6e34..1c38558 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' describe Oxidized::Node do before(:each) do - Oxidized.stubs(:asetus).returns(Asetus.new) + Oxidized.asetus = Asetus.new + Oxidized.setup_logger Oxidized::Node.any_instance.stubs(:resolve_output) @node = Oxidized::Node.new(name: 'example.com', -- cgit v1.2.1 From 7000d42b8634396b518568939bb1f6ac9e49e4d3 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Thu, 2 Jun 2016 22:34:19 +0200 Subject: fix specs --- spec/cli_spec.rb | 4 +--- spec/nodes_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 0a6c91b..b248766 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -9,11 +9,9 @@ describe Oxidized::CLI do %w[-v --version].each do |option| describe option do - before { ARGV.replace [option] } + before { ARGV.push(option) } it 'prints the version and exits' do - Oxidized::Config.expects(:load) - Oxidized.expects(:setup_logger) Kernel.expects(:exit) proc { diff --git a/spec/nodes_spec.rb b/spec/nodes_spec.rb index 5f2ef95..4560bdb 100644 --- a/spec/nodes_spec.rb +++ b/spec/nodes_spec.rb @@ -3,7 +3,9 @@ require 'spec_helper' describe Oxidized::Nodes do before(:each) do Resolv.any_instance.stubs(:getaddress) - Oxidized.stubs(:asetus).returns(Asetus.new) + Oxidized.asetus = Asetus.new + Oxidized.setup_logger + opts = { input: 'ssh', output: 'git', -- cgit v1.2.1 From 369bf7c96cfcf342c55f7a57170bd00c352154e3 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Thu, 2 Jun 2016 23:41:42 +0200 Subject: cleaner spec --- spec/cli_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'spec') diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index b248766..f3e7cb4 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -2,21 +2,21 @@ require 'spec_helper' require 'oxidized/cli' describe Oxidized::CLI do - let(:asetus) { mock() } - + before do + @original = ARGV + @asetus = Asetus.new + end after { ARGV.replace @original } - before { @original = ARGV } %w[-v --version].each do |option| describe option do - before { ARGV.push(option) } + before { ARGV.replace([option]) } it 'prints the version and exits' do + Asetus.expects(:new).returns(@asetus) Kernel.expects(:exit) - proc { - Oxidized::CLI.new - }.must_output "#{Oxidized::VERSION}\n" + assert_output("#{Oxidized::VERSION}\n") { Oxidized::CLI.new } end end end -- cgit v1.2.1 From 64bdbeb673a8ab7155478ee5e0d1d58c1631a9d3 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Thu, 2 Jun 2016 23:51:08 +0200 Subject: fix cli spec --- spec/cli_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index f3e7cb4..eb9872e 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -2,10 +2,7 @@ require 'spec_helper' require 'oxidized/cli' describe Oxidized::CLI do - before do - @original = ARGV - @asetus = Asetus.new - end + before { @original = ARGV } after { ARGV.replace @original } %w[-v --version].each do |option| @@ -13,7 +10,9 @@ describe Oxidized::CLI do before { ARGV.replace([option]) } it 'prints the version and exits' do - Asetus.expects(:new).returns(@asetus) + Oxidized::Config.expects(:load) + Oxidized.expects(:setup_logger) + File.expects(:expand_path) Kernel.expects(:exit) assert_output("#{Oxidized::VERSION}\n") { Oxidized::CLI.new } -- cgit v1.2.1