Sha256: 1d34795c841ab246f5e0d804e58a8b21ab48f03905f6767664c35062c5587021

Contents?: true

Size: 1.08 KB

Versions: 31

Compression:

Stored size: 1.08 KB

Contents

FactoryGirl.define do
    factory :dummy_module_platform,
          class: Dummy::Module::Platform,
          traits: [
              :metasploit_model_base,
              :metasploit_model_module_platform
          ] do
    ignore do
      # have to use module_type from metasploit_model_module_platform trait to ensure module_instance will support
      # module platforms.
      module_class { FactoryGirl.create(:dummy_module_class, module_type: module_type) }
    end

    module_instance {
      FactoryGirl.build(
          :dummy_module_instance,
          module_class: module_class,
          # disable module_instance factory from building module_platforms since this factory is already building one
          module_platforms_length: 0
      )
    }
    platform { generate :dummy_platform }

    after(:build) do |module_platform|
      module_instance = module_platform.module_instance

      if module_instance
        unless module_instance.module_platforms.include? module_platform
          module_instance.module_platforms << module_platform
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
metasploit-model-0.28.0 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.28.0-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.4 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.4-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.3 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.3-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.2 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.2-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.1 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.1-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.0 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.0-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.27.0.pre.dep.pre.railties spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.26.1-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.26.1 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.25.7 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.25.7-java spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.25.6 spec/dummy/spec/factories/dummy/module/platforms.rb
metasploit-model-0.25.6-java spec/dummy/spec/factories/dummy/module/platforms.rb