Sha256: a1c3c7a35626d325923be9d30c0ca718f15cb36bf14ae131e089d67bfc21febf

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

module Naf
  describe AffinityClassification do
    # Mass-assignment
    [:affinity_classification_name].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 have_many(:affinities) }

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

    it { should validate_presence_of(:affinity_classification_name) }

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

    describe "#purpose" do
      let!(:purpose_affinity_classification) { FactoryGirl.create(:purpose_affinity_classification) }

      it "return the purpose affinity classification" do
        ::Naf::AffinityClassification.purpose.should == purpose_affinity_classification
      end
    end

    describe "#location" do
      let!(:location_affinity_classification) { FactoryGirl.create(:location_affinity_classification) }

      it "return the location affinity classification" do
        ::Naf::AffinityClassification.location.should == location_affinity_classification
      end
    end

    describe "#application" do
      let!(:application_affinity_classification) { FactoryGirl.create(:application_affinity_classification) }

      it "return the application affinity classification" do
        ::Naf::AffinityClassification.application.should == application_affinity_classification
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
naf-1.1.4 spec/models/naf/affinity_classification_spec.rb
naf-1.1.3 spec/models/naf/affinity_classification_spec.rb
naf-1.1.2 spec/models/naf/affinity_classification_spec.rb
naf-1.1.1 spec/models/naf/affinity_classification_spec.rb
naf-1.1.0 spec/models/naf/affinity_classification_spec.rb