Sha256: 0446e2b721447945cb47c0ea3d90ea48206210e1dfc8de294becffd16f9069f7

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

describe Unidom::Position::Position, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    model_attributes = {
      organization_id:   SecureRandom.uuid,
      organization_type: 'Unidom::Position::Organization::Mock',
      occupation_id:     SecureRandom.uuid,
      name:              'Some Position'
    }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes

    it_behaves_like 'validates text', model_attributes, :name, length: 2..described_class.columns_hash['name'].limit

    occupation_attributes = {
      scheme_id:   SecureRandom.uuid,
      scheme_type: 'Unidom::Position::Scheme::Mock',
      code:        '5-1-99',
      name:        'Some Occupation'
    }

    it_behaves_like 'belongs_to', model_attributes, :occupation, Unidom::Position::Occupation, occupation_attributes

    post_1_attributes = {
      organization_id:   SecureRandom.uuid,
      organization_type: 'Unidom::Position::Organization::Mock',
      #position_id:       SecureRandom.uuid,
      name:              'Some Post #1'
    }

    post_2_attributes = {
      organization_id:   SecureRandom.uuid,
      organization_type: 'Unidom::Position::Organization::Mock',
      #position_id:       SecureRandom.uuid,
      name:              'Some Post #2'
    }

    it_behaves_like 'has_many', model_attributes, :posts, Unidom::Position::Post, [ post_1_attributes, post_2_attributes ]

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-position-1.5.4 lib/rspec/models/unidom/position/position_spec.rb