Sha256: 2c71b96f26d7fbdd769cab31464c9e7f5584bfd947f3504224ed3d962a6e571b

Contents?: true

Size: 905 Bytes

Versions: 9

Compression:

Stored size: 905 Bytes

Contents

module NoradSpecRunner
  class SecTest
    UNSUPPORTED_SPEC_FILE = "#{File.expand_path(File.dirname(__FILE__))}/support/os_not_supported_spec.rb"
    attr_reader :tests_parent_dir, :test_name, :platform

    def initialize(tests_parent_dir, test_name, platform)
      @tests_parent_dir = tests_parent_dir
      @test_name = test_name
      @platform = platform
      print_detection_message
    end

    def test_to_run
      suggested_test_file_exists? ? suggested_test_file : default_test_file
    end

    def suggested_test_file_exists?
      File.exist?("#{tests_parent_dir}/#{suggested_test_file}")
    end

    def suggested_test_file
      "#{test_name}/#{platform}_spec.rb"
    end

    def default_test_file
      UNSUPPORTED_SPEC_FILE
    end

    private

    def print_detection_message
      platform ? puts("Platform #{platform} detected!") : puts("Unable to detect OS!")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
norad_spec_runner-0.5.2 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.5.1 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.5.0 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.6 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.5 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.4 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.3 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.2 lib/norad_spec_runner/sec_test.rb
norad_spec_runner-0.4.1 lib/norad_spec_runner/sec_test.rb