Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix: don't assume handler is installed as global executable
Browse files Browse the repository at this point in the history
Close #4
  • Loading branch information
honzajavorek committed May 28, 2019
1 parent ae41b82 commit 69479e0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
3 changes: 1 addition & 2 deletions features/execution_order.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Feature: Execution order

Background:
Given I have "{{my-executable-path}}" command installed
And I have "dredd" command installed
Given I have Dredd installed
And a file named "server.js" with:
"""
require('http')
Expand Down
3 changes: 1 addition & 2 deletions features/failing_transaction.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Feature: Failing a transaction

Background:
Given I have "{{my-executable-path}}" command installed
And I have "dredd" command installed
Given I have Dredd installed
And a file named "server.js" with:
"""
require('http')
Expand Down
3 changes: 1 addition & 2 deletions features/hook_handlers.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Feature: Hook handlers

Background:
Given I have "{{my-executable-path}}" command installed
And I have "dredd" command installed
Given I have Dredd installed
And a file named "server.js" with:
"""
require('http')
Expand Down
3 changes: 1 addition & 2 deletions features/multiple_hookfiles.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Feature: Multiple hook files with a glob

Background:
Given I have "{{my-executable-path}}" command installed
And I have "dredd" command installed
Given I have Dredd installed
And a file named "server.js" with:
"""
require('http')
Expand Down
13 changes: 5 additions & 8 deletions features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ After(async function () {
});


Given(/^I have "([^"]+)" command installed$/, function (match) {
const command = match === 'dredd'
? DREDD_BIN
: match;
which.sync(command); // throws if the command is not found
Given('I have Dredd installed', function () {
which.sync(DREDD_BIN); // throws if not found
});

Given(/^a file named "([^"]+)" with:$/, function (filename, content) {
Expand All @@ -41,9 +38,8 @@ Given(/^I set the environment variables to:$/, function (env) {
});


When(/^I run `([^`]+)`$/, function (match) {
const command = match.replace(/^dredd(?= )/, DREDD_BIN);
this.proc = childProcess.spawnSync(command, [], {
When(/^I run `dredd ([^`]+)`$/, function (args) {
this.proc = childProcess.spawnSync(`${DREDD_BIN} ${args}`, [], {
shell: true,
cwd: this.dir,
env: this.env,
Expand Down Expand Up @@ -71,6 +67,7 @@ When('I wait for output to contain {string}', function (output, callback) {

proc.stdout.on('data', read);
proc.stderr.on('data', read);
proc.on('error', callback);
});

When('I connect to the server', async function () {
Expand Down

0 comments on commit 69479e0

Please sign in to comment.