Sha256: 647f4ff6e8a3d0110de74f0ae6f30b646d00c616e4baf8bcee650c2a501e37d3

Contents?: true

Size: 1.32 KB

Versions: 31

Compression:

Stored size: 1.32 KB

Contents

FactoryGirl.define do
  factory :dummy_module_target_platform,
          class: Dummy::Module::Target::Platform,
          traits: [
              :metasploit_model_base
          ] do
    association :module_target,
                factory: :dummy_module_target,
                strategy: :build,
                # disable module_target factory from building target_platforms since this factory is already
                # building one
                target_platforms_length: 0

    platform { generate :dummy_platform }

    after(:build) do |module_target_platform|
      module_target = module_target_platform.module_target

      if module_target
        unless module_target.target_platforms.include? module_target_platform
          module_target.target_platforms << module_target_platform
        end

        module_instance = module_target.module_instance
        platform = module_target_platform.platform

        if module_instance && platform
          actual_platform_set = module_instance.module_platforms.map(&:platform)

          unless actual_platform_set.include? platform
            module_instance.module_platforms << FactoryGirl.build(
                :dummy_module_platform,
                module_instance: module_instance,
                platform: platform
            )
          end
        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/target/platforms.rb
metasploit-model-0.28.0-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.4 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.4-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.3 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.3-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.2 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.2-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.1 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.1-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.0 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.0-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.27.0.pre.dep.pre.railties spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.26.1-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.26.1 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.25.7 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.25.7-java spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.25.6 spec/dummy/spec/factories/dummy/module/target/platforms.rb
metasploit-model-0.25.6-java spec/dummy/spec/factories/dummy/module/target/platforms.rb