Sha256: 73206f617da46774d8dc861f8dbebaf06c731273d61a287f37ebbaf225e110e8

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

module Koine
  class TestRunner
    class Adapters
      class BaseAdapter
        # attr_writer :next_adapter

        attr_writer :next_adapter

        def next_adapter
          @next_adapter || raise("next_adapter is not set for #{self.class}")
        end

        def test_command(config)
          unless accept?(config)
            return next_adapter.test_command(config)
          end

          if config.all?
            return all_tests(config)
          end

          if config.line?
            return file_line_command(config)
          end

          single_file_command(config)
        end

        private

        def accept?(_config)
          false
        end

        def all_tests(config)
          script_for(config)
        end

        def file_line_command(config)
          [single_file_command(config), config.line].join(':')
        end

        def single_file_command(config)
          [script_for(config), config.file_path].join(' ')
        end

        def script_for(_config)
          raise 'Not implemented'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
koine-test_runner-0.4.0 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.3.0 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.2.4 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.2.3 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.2.2 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.2.1 lib/koine/test_runner/adapters/base_adapter.rb
koine-test_runner-0.2.0 lib/koine/test_runner/adapters/base_adapter.rb