Sha256: bc3fbb094da029876c1110384a24bc2670d6b0019dfbe72190a093cbfa34db7d
Contents?: true
Size: 1.81 KB
Versions: 5
Compression:
Stored size: 1.81 KB
Contents
require 'spec_helper' describe Mdm::Service do context "Associations" do it { should have_many(:task_services).class_name('Mdm::TaskService').dependent(:destroy) } it { should have_many(:tasks).class_name('Mdm::Task').through(:task_services) } it { should have_many(:creds).class_name('Mdm::Cred').dependent(:destroy) } it { should have_many(:exploited_hosts).class_name('Mdm::ExploitedHost').dependent(:destroy) } it { should have_many(:notes).class_name('Mdm::Note').dependent(:destroy) } it { should have_many(:vulns).class_name('Mdm::Vuln').dependent(:destroy) } it { should have_many(:web_sites).class_name('Mdm::WebSite').dependent(:destroy) } it { should have_many(:web_pages).class_name('Mdm::WebPage').through(:web_sites) } it { should have_many(:web_forms).class_name('Mdm::WebForm').through(:web_sites) } it { should have_many(:web_vulns).class_name('Mdm::WebVuln').through(:web_sites) } it { should belong_to(:host).class_name('Mdm::Host') } end context "inactive" do it "should exclude open services" do open_service = FactoryGirl.create(:mdm_service, :state => 'open') Mdm::Service.inactive.should_not include(open_service) end end context "with_state open" do it "should exclude closed services" do closed_service = FactoryGirl.create(:mdm_service, :state => 'closed') Mdm::Service.with_state('open').should_not include(closed_service) end end context "search for 'snmp'" do it "should find only services that match" do snmp_service = FactoryGirl.create(:mdm_service) ftp_service = FactoryGirl.create(:mdm_service, :proto => 'ftp') search_results = Mdm::Service.search('snmp') search_results.should include(snmp_service) search_results.should_not include(ftp_service) end end end
Version data entries
5 entries across 5 versions & 1 rubygems