Sha256: 162b83139c923dab168975273eaa12f4287d1a65a53b918470de4ec453ce75e2

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

require 'spec_helper'

describe Mdm::Task do

  context "Associations" do

    it { should have_many(:task_creds).class_name('Mdm::TaskCred').dependent(:destroy) }
    it { should have_many(:creds).class_name('Mdm::Cred').through(:task_creds) }
    it { should have_many(:task_hosts).class_name('Mdm::TaskHost').dependent(:destroy) }
    it { should have_many(:hosts).class_name('Mdm::Host').through(:task_hosts) }
    it { should have_many(:task_services).class_name('Mdm::TaskService').dependent(:destroy) }
    it { should have_many(:services).class_name('Mdm::Service').through(:task_services) }
    it { should belong_to(:workspace).class_name('Mdm::Workspace') }
    it { should have_many(:reports).class_name('Mdm::Report')}
  end

  context "running" do
    it "should exclude completed tasks" do
      task = FactoryGirl.create(:mdm_task, :completed_at => Time.now)
      Mdm::Task.running.should_not include(task)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metasploit_data_models-0.15.2-java spec/app/models/mdm/task_spec.rb
metasploit_data_models-0.15.2 spec/app/models/mdm/task_spec.rb