spec/blocks_spec.rb in sloe-0.8.6 vs spec/blocks_spec.rb in sloe-0.8.7

- old
+ new

@@ -1,31 +1,52 @@ require 'spec_helper' describe Sloe do - let(:login) { {target: 'crtj-0dc1-0001', username: 'netadmin', password: 'pass123'} } context "invoked with block" do + before(:all) do + @login = { + :target => 'capella', + :username => 'netconf', + :password => 'netconf' + } + @hostname = '' + end + it "calls Netconf RPC" do - hostname = '' - Sloe::Device.new(login) { |dut| - hostname = dut.rpc.get_system_information.xpath('//host-name').text + Sloe::Device.new( @login ) { |dut| + sw_info = dut.rpc.get_system_information + @hostname = sw_info.xpath('//host-name').text } - expect(hostname).to include login[:target] + @hostname.should include @login[:target] end it "calls SNMP RPC" do - hostname = '' - Sloe::Device.new (login) { |dut| - hostname = dut.snmp.get_value( 'sysName.0' ).to_s + Sloe::Device.new ( @login ) { |dut| + @hostname = dut.snmp.get_value( 'sysName.0' ).to_s } - expect(hostname).to include login[:target] + @hostname.should include @login[:target] end + end context "Junos extensions" do + before(:all) do + @login = { + :target => 'capella', + :username => 'netconf', + :password => 'netconf' + } + end + it "Sloe::Junos responds to Junos specific RPCs" do - expect( Sloe::Junos.new(login).rpc ).to respond_to(:lock_configuration) + Sloe::Junos.new ( @login ) { |dut| + dut.rpc.respond_to?(:lock_configuration).should be true + } end it "Sloe::Device does not respond to Junos specific RPCs" do - expect( Sloe::Device.new(login).rpc ).to_not respond_to(:lock_configuration) + Sloe::Device.new ( @login ) { |dut| + dut.rpc.respond_to?(:lock_configuration).should be false + } end + end end \ No newline at end of file