Sha256: 4beacd4fde5028edc06fe8bb3ffed1b9823e2ef9b57e757fa40135b8c4700941

Contents?: true

Size: 1.36 KB

Versions: 23

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

module Naf
  describe HistoricalJobAffinityTab do
    let!(:historical_job_affinity_tab) { FactoryGirl.create(:normal_job_affinity_tab) }

    # Mass-assignment
    [:affinity_id,
     :historical_job_id,
     :historical_job,
     :affinity_parameter].each do |a|
      it { should allow_mass_assignment_of(a) }
    end

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

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

    it { should belong_to(:affinity) }

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

    it { should validate_presence_of(:affinity_id) }

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

    describe "#job" do
      let(:job) { FactoryGirl.create(:job) }

      it "return the correct job" do
        historical_job_affinity_tab.historical_job_id = job.id
        historical_job_affinity_tab.job.should == job
      end
    end

    describe "#script_type_name" do
      it "return the correct name" do
        historical_job_affinity_tab.script_type_name.should == "rails"
      end
    end

    describe "#command" do
      it "return the correct command" do
        historical_job_affinity_tab.command.
          should == "::Naf::HistoricalJob.test hello world"
      end
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

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