Sha256: 015a36664eb1081701a41cb0e2e5ec3cb302440bb79ce436ca4be332f69bdc60

Contents?: true

Size: 1.3 KB

Versions: 18

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

module Naf
  describe MachineRunnerInvocation do
    # Mass-assignment
    [:machine_runner_id,
     :pid,
     :dead_at,
     :wind_down_at,
     :commit_information,
     :branch_name,
     :repository_name,
     :deployment_tag,
     :uuid].each do |a|
      it { should allow_mass_assignment_of(a) }
    end

    [:id,
     :created_at,
     :updated_at].each do |a|
      it { should_not allow_mass_assignment_of(a) }
    end

    #---------------------
    # *** Associations ***
    #+++++++++++++++++++++

    it { should belong_to(:machine_runner) }
    it { should have_many(:historical_jobs) }

    #--------------------
    # *** Validations ***
    #++++++++++++++++++++

    it { should validate_presence_of(:machine_runner_id) }
    it { should validate_presence_of(:pid) }

    #----------------------
    # *** Class Methods ***
    #++++++++++++++++++++++

    describe "#recently_marked_dead" do
      let!(:invocation) { FactoryGirl.create(:machine_runner_invocation, dead_at: Time.zone.now - 1.hour) }
      before do
        FactoryGirl.create(:machine_runner_invocation, dead_at: Time.zone.now - 40.hours)
      end

      it "return the correct invocation" do
        ::Naf::MachineRunnerInvocation.recently_marked_dead(24.hours).should == [invocation]
      end
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
naf-2.1.13 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.12 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.11 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.10 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.9 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.8 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.6 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.5 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.4 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.3 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.2 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.1 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.1.0 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.0.4 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.0.3 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.0.2 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.0.1 spec/models/naf/machine_runner_invocation_spec.rb
naf-2.0.0 spec/models/naf/machine_runner_invocation_spec.rb