Sha256: 5ef1908d46ffbd568275733b747cf6a016cf27cccab283cf993944161708a6c0

Contents?: true

Size: 793 Bytes

Versions: 8

Compression:

Stored size: 793 Bytes

Contents

module Inferno
  module Entities
    module HasRunnable
      # Returns the Test, TestGroup, or TestSuite associated with this entity
      #
      # @return [Inferno::Entities::Test, Inferno::Entities::TestGroup, Inferno::Entities::TestSuite]
      def runnable
        return @runnable if @runnable

        @runnable = test || test_group || test_suite || load_runnable
      end

      private

      def load_runnable
        if test_id.present?
          @test = Inferno::Repositories::Tests.new.find(test_id)
        elsif test_group_id.present?
          @test_group = Inferno::Repositories::TestGroups.new.find(test_group_id)
        elsif test_suite_id.present?
          @test_suite = Inferno::Repositories::TestSuites.new.find(test_suite_id)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inferno_core-0.6.1 lib/inferno/entities/has_runnable.rb
inferno_core-0.6.0 lib/inferno/entities/has_runnable.rb
inferno_core-0.5.4 lib/inferno/entities/has_runnable.rb
inferno_core-0.5.3 lib/inferno/entities/has_runnable.rb
inferno_core-0.5.2 lib/inferno/entities/has_runnable.rb
inferno_core-0.5.1 lib/inferno/entities/has_runnable.rb
inferno_core-0.5.0 lib/inferno/entities/has_runnable.rb
inferno_core-0.4.44 lib/inferno/entities/has_runnable.rb