Sha256: 903e0aaa22b0ca66aa33afa455a3512335d784bbaeaecb6d50b3254678611237

Contents?: true

Size: 1019 Bytes

Versions: 16

Compression:

Stored size: 1019 Bytes

Contents

RSpec.describe Metasploit::Model::Association::Reflection, type: :model do
  context 'validations' do
    it { is_expected.to validate_presence_of :model }
    it { is_expected.to validate_presence_of :name }
    it { is_expected.to validate_presence_of :class_name }
  end

  context '#klass' do
    subject(:klass) do
      reflection.klass
    end


    let(:class_name) do
      FactoryBot.generate :metasploit_model_association_reflection_class_name
    end

    let(:class_name_class) do
      Class.new
    end

    let(:model) do
      Class.new
    end

    let(:name) do
      FactoryBot.generate :metasploit_model_association_reflection_name
    end

    let(:reflection) do
      described_class.new(
          :model => model,
          :name => name,
          :class_name => class_name
      )
    end

    before(:example) do
      stub_const(class_name, class_name_class)
    end

    it 'should return Class with Class#name #class_name' do
      expect(klass).to eq(class_name_class)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-5.0.1 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-5.0.0 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.6 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.5 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.4 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.3 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.2 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.1 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-4.0.0 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.1.4 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.1.3 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.1.2 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.1.1 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.1.0 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-3.0.0 spec/app/models/metasploit/model/association/reflection_spec.rb