summaryrefslogtreecommitdiff
path: root/spec/node_spec.rb
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiev@shopify.com>2015-10-27 14:49:52 -0400
committerElvin Efendi <elvin.efendiev@shopify.com>2015-11-13 11:12:31 -0500
commitf2da63369fcb754e3715091cc4fd2f93db42106e (patch)
tree0e985374cc7b4bd8111c012072c39218335881ef /spec/node_spec.rb
parent1400b842f6dc61e662ce15f72f578a55126ffc06 (diff)
better test framework, more specs and Travis CI
Diffstat (limited to 'spec/node_spec.rb')
-rw-r--r--spec/node_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/node_spec.rb b/spec/node_spec.rb
new file mode 100644
index 0000000..c568463
--- /dev/null
+++ b/spec/node_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe Oxidized::Node do
+ before(:each) do
+ Oxidized.stubs(:asetus).returns(Asetus.new)
+
+ Oxidized::Node.any_instance.stubs(:resolve_output)
+ @node = Oxidized::Node.new(name: 'example.com',
+ input: 'ssh',
+ output: 'git',
+ model: 'junos',
+ username: 'alma',
+ password: 'armud',
+ prompt: 'test_prompt')
+
+ end
+
+ describe '#new' do
+ it 'should resolve input' do
+ @node.input[0].to_s.split('::')[1].must_equal 'SSH'
+ end
+ it 'should resolve model' do
+ @node.model.class.must_equal JunOS
+ end
+ it 'should resolve username' do
+ @node.auth[:username].must_equal 'alma'
+ end
+ it 'should resolve password' do
+ @node.auth[:password].must_equal 'armud'
+ end
+ it 'should require prompt' do
+ @node.prompt.must_equal 'test_prompt'
+ end
+ end
+
+ describe '#run' do
+ it 'should fetch the configuration' do
+ stub_oxidized_ssh
+
+ status, _ = @node.run
+ status.must_equal :success
+ end
+ end
+end