Sha256: ceae513ad04c63f29ae7518079c75bd31d0067f8540f6be434bf195a7f3a5f2b

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Polytrix do
  describe '.find_implementor' do
    before do
      Polytrix.configuration.manifest = 'samples/polytrix.yml'
    end

    it 'returns nil if no implementor is found for the file' do
      tempfile = Tempfile.new(['foo', '.java'])
      expect(described_class.find_implementor tempfile.path).to be_nil
    end

    it 'finds implementors from by matching basedir to an already loaded implementor' do
      Polytrix.manifest.implementors['java'] = Fabricate(:implementor, name: 'java', basedir: 'samples/sdks/java')
      # Polytrix.configuration.implementor(
      #   name: 'java',
      #   basedir: 'samples/sdks/java'
      # )

      sample_file = 'samples/sdks/java/challenges/HelloWorld.java'
      implementor = described_class.find_implementor sample_file
      expect(implementor).to be_an_instance_of Polytrix::Implementor
      expect(implementor.name).to eq('java')
    end
  end

  describe '.validate' do
    context 'block given' do
      it 'creates and registers a validator' do
        Polytrix.validate 'custom validator', suite: 'test', sample: 'test' do |challenge|
          # Validate the challenge results
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polytrix-0.1.2 spec/polytrix_spec.rb
polytrix-0.1.1 spec/polytrix_spec.rb