Sha256: 0508e9aae67e70cc454972380dedc512454331d9c0e71f59560b91f16611372f

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

module Polytrix
  module Runners
    module Middleware
      describe FeatureExecutor do
        let(:app) { double('Middleware Chain') }
        let(:challenge_runner) { double('ChallengeRunner') }
        subject(:middleware) { described_class.new app }

        describe '#call' do
          let(:env) do
            {
              basedir: Pathname.new('spec/fixtures'),
              env_file: 'tmp/vars.sh',
              source_file: Pathname.new('spec/fixtures/test.js'),
              command: 'some command to execute',
              challenge_runner: challenge_runner
            }
          end

          before do
            allow(challenge_runner).to receive(:challenge_command).with(env[:env_file], Pathname.new('test.js')).and_return('some command to execute')
            allow(challenge_runner).to receive(:run_command).with('some command to execute').and_return Polytrix::Result.new(process: 'a', source: 'b', data: 'c')
            allow(app).to receive(:call).with(env)
          end

          # Most of this belongs in the ChallengeRunner...
          xit 'finds the challenge' do
          end

          xit 'setups the env vars' do
          end

          xit 'gets the command' do
          end

          it 'returns a result' do
            expect(middleware.call(env)).to be_an_instance_of Polytrix::Result
          end

          it 'continues the middleware chain' do
            expect(app).to receive(:call).with env
            middleware.call(env)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polytrix-0.0.1 spec/polytrix/middleware/feature_executor_spec.rb