Sha256: e3e1a4b4a03a466982c68c05fffee66f6cbb591671b815b61bd1b3cc3fcd3ee2

Contents?: true

Size: 1.76 KB

Versions: 38

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

describe Metasploit::Model::Translation do
  let(:base_class) do
    described_class = self.described_class

    Class.new do
      include described_class
    end
  end

  context 'lookup_ancestors' do
    subject(:lookup_ancestors) do
      base_class.lookup_ancestors
    end

    let(:base_class) do
      described_class = self.described_class

      Class.new(named_class) do
        include described_class
      end
    end

    let(:named_class) do
      named_module = self.named_module
      unnamed_class = self.unnamed_class

      Class.new(unnamed_class) do
        include named_module

        def self.model_name

        end
      end
    end

    let(:named_module) do
      Module.new do
        def self.model_name

        end
      end
    end

    let(:unnamed_class) do
      unnamed_module = self.unnamed_module

      Class.new do
        include unnamed_module
      end
    end

    let(:unnamed_module) do
      Module.new
    end

    it 'should have named and unnamed ancestors' do
      base_class.ancestors.should include(named_class)
      base_class.ancestors.should include(named_module)
      base_class.ancestors.should include(unnamed_class)
      base_class.ancestors.should include(unnamed_module)
    end

    it 'should return all ancestors that respond to model_name' do
      lookup_ancestors.should include(base_class)
      lookup_ancestors.should include(named_class)
      lookup_ancestors.should include(named_module)
    end

    it 'should not return ancestors that do not respond to model_name' do
      lookup_ancestors.should_not include(unnamed_class)
      lookup_ancestors.should_not include(unnamed_module)
    end
  end

  context 'i18n_scope' do
    subject(:i18n_scope) do
      'metasploit.model'
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.30.0 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.30.0-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.29.2 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.29.2-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.29.0 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.29.0-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.28.0 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.28.0-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.4 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.4-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.3 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.3-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.2 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.2-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.1 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.1-java spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.0 spec/lib/metasploit/model/translation_spec.rb
metasploit-model-0.27.0-java spec/lib/metasploit/model/translation_spec.rb