Skip to content

Commit

Permalink
Update steps.rb to resolve issues hidroh#8 and hidroh#19
Browse files Browse the repository at this point in the history
-Add a custom step to clear cache on demand from feature file
-POST with json file
  • Loading branch information
kevgatch authored Sep 12, 2017
1 parent 0371719 commit 67a9472
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/cucumber-api/steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
require 'cucumber-api/helpers'
require 'rest-client'
require 'json-schema'
require 'json'

if ENV['cucumber_api_verbose'] == 'true'
RestClient.log = 'stdout'
end

$cache = {}
Given(/^I clear the response cache$/) do
$cache = {}
end

Given(/^I send and accept JSON$/) do
steps %Q{
Expand Down Expand Up @@ -77,7 +80,7 @@
when 'yml'
@body = YAML.load File.open(path)
when 'json'
@body = JSON.parse File.read(path)
@body = JSON.dump(JSON.parse File.read(path))
else
raise %/Unsupported file type: '#{path}'/
end
Expand Down

0 comments on commit 67a9472

Please sign in to comment.