Sha256: 7e3b590cc9ac96fa7182c582f9936682ccc3a2ba30102c87f65ffa2ee3d9c8a9

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

shared_examples_for 'Metasploit::Model::Configuration::Parent#child' do |name, options={}|
  options.assert_valid_keys(:class)

  klass = options.fetch(:class)
  class_attribute_name = "#{name}_class"

  context "##{name}" do
    subject(:child) do
      configuration.send(name)
    end

    context "with default ##{class_attribute_name}" do
      it { should be_a klass }
    end

    context "without default ##{class_attribute_name}" do
      #
      # lets
      #

      let(:non_default_class) do
        Class.new do
          attr_accessor :configuration
        end
      end

      #
      # Callbacks
      #

      before(:each) do
        configuration.send("#{class_attribute_name}=", non_default_class)
      end

      it "is instance of ##{class_attribute_name}" do
        expect(child).to be_a non_default_class
      end
    end

    context '#configuration' do
      subject(:child_configuration) do
        child.configuration
      end

      it 'is this configuration' do
        expect(child_configuration).to eq(configuration)
      end
    end
  end

  context "#{class_attribute_name}" do
    subject(:child_class) do
      configuration.send(class_attribute_name)
    end

    context 'default' do
      it { should be klass }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
metasploit-model-0.27.0.pre.dep.pre.railties spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.26.1-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.26.1 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.7 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.7-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.6 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.6-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.3 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.3-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.2 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.2-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.1 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.1-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.24.1-java spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.24.1 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 spec/support/shared/examples/metasploit/model/configuration/parent/child.rb