Sha256: 3b6fda5ea6f89c8a247572539187949439d55a51372a63287c8341bb4545adfa

Contents?: true

Size: 1018 Bytes

Versions: 8

Compression:

Stored size: 1018 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
      FactoryGirl.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
      FactoryGirl.generate :metasploit_model_association_reflection_name
    end

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

    before(:each) 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

8 entries across 8 versions & 1 rubygems

Version Path
metasploit-model-1.0.2 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-1.0.1 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-1.0.0 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-0.30.2 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-0.30.2-java spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-0.30.1 spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-0.30.1-java spec/app/models/metasploit/model/association/reflection_spec.rb
metasploit-model-0.30.1.pre.rspec.pre.3.pre.1 spec/app/models/metasploit/model/association/reflection_spec.rb