Sha256: f03b31a5e55973cbc1083807d1c374806f4c59a2a7ebb9c2e485888da8294253

Contents?: true

Size: 850 Bytes

Versions: 23

Compression:

Stored size: 850 Bytes

Contents

require 'spec_helper'

module Naf
  describe MachineRunner do
    # Mass-assignment
    [:machine_id,
     :runner_cwd].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) }
    it { should have_many(:machine_runner_invocations) }

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

    it { should validate_presence_of(:machine_id) }
    it { should validate_presence_of(:runner_cwd) }

    describe "uniqueness"do
      subject { FactoryGirl.create(:machine_runner) }
      it { should validate_uniqueness_of(:machine_id).scoped_to(:runner_cwd) }
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-1.1.2 spec/models/naf/machine_runner_spec.rb
naf-1.1.1 spec/models/naf/machine_runner_spec.rb
naf-1.1.0 spec/models/naf/machine_runner_spec.rb