spec/port_spec.rb in ruby-nmap-0.6.0 vs spec/port_spec.rb in ruby-nmap-0.7.0
- old
+ new
@@ -1,39 +1,38 @@
require 'spec_helper'
require 'nmap/port'
describe Port do
- let(:xml) { XML.new(Helpers::SCAN_FILE) }
+ subject { @xml.hosts.first.ports.first }
- subject { xml.hosts.first.ports.first }
-
it "should parse the protocol" do
subject.protocol.should == :tcp
end
it "should parse the port number" do
- subject.number.should == 21
+ subject.number.should == 22
end
it "should parse the state" do
- subject.state.should == :closed
+ subject.state.should == :open
end
it "should parse the reason" do
- subject.reason.should == 'reset'
+ subject.reason.should == 'syn-ack'
end
- it "should parse the detected service" do
- subject.service.name.should == 'ftp'
+ describe "#service" do
+ subject { super().service }
+
+ it "should return a Service object" do
+ subject.should be_kind_of(Service)
+ end
end
- context "when NSE scripts are ran" do
- let(:xml) { XML.new(Helpers::NSE_FILE) }
+ include_examples "#scripts"
- it "should parse the output of scripts" do
- subject.scripts.should_not be_empty
-
- subject.scripts.keys.should_not include(nil)
- subject.scripts.values.should_not include(nil)
+ describe "#inspect" do
+ it "should include the number" do
+ subject.inspect.should include(subject.number.to_s)
end
end
end