Sha256: 8842106a7d0f94a60b6db093ab439bff09b7c7ce2ed07706783106f242737abb

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

begin
  require 'rack/test'

  World(Rack::Test::Methods)

  Given(/^I send and accept JSON$/) do
    header 'Accept', 'application/json'
    header 'Cotent-Type', 'application/json'
  end

  Given(/^I send a GET request for "([^\"]*)"$/) do |path|
    in_current_dir { get path }
  end

  # rubocop:disable LineLength
  Given(/^I send a POST request for "([^\"]*)" with body "([^\"]*)"$/) do |path, body|
    in_current_dir { post path, Object.instance_eval(body) }
  end
  # rubocop:enable LineLength

  # rubocop:disable LineLength
  Given(/^I send a DELETE request for "([^\"]*)" with body "([^\"]*)"$/) do |path, body|
    in_current_dir { delete path, Object.instance_eval(body) }
  end
  # rubocop:enable LineLength

  Then(/^the response should be "([^\"]*)"$/) do |status|
    expect(last_response.status).to eq(status.to_i)
  end

  Then(/^the JSON response should be "([^\"]*)"$/) do |json|
    expect(JSON.parse(last_response.body)).to eq(JSON.parse(json))
  end

  Then(/^the JSON response should be:$/) do |json|
    expect(JSON.parse(last_response.body)).to eq(JSON.parse(json))
  end
rescue LoadError
  $stderr.puts 'Rack is disabled'
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
pio-0.30.1 features/step_definitions/rest_api_steps.rb
trema-0.8.4 features/step_definitions/rest_api_steps.rb
trema-0.8.3 features/step_definitions/rest_api_steps.rb
pio-0.30.0 features/step_definitions/rest_api_steps.rb
trema-0.8.2 features/step_definitions/rest_api_steps.rb
pio-0.29.0 features/step_definitions/rest_api_steps.rb
trema-0.8.1 features/step_definitions/rest_api_steps.rb
pio-0.28.1 features/step_definitions/rest_api_steps.rb
pio-0.28.0 features/step_definitions/rest_api_steps.rb
trema-0.8.0 features/step_definitions/rest_api_steps.rb
pio-0.27.2 features/step_definitions/rest_api_steps.rb
trema-0.7.1 features/step_definitions/rest_api_steps.rb
pio-0.27.1 features/step_definitions/rest_api_steps.rb
trema-0.7.0 features/step_definitions/rest_api_steps.rb
pio-0.27.0 features/step_definitions/rest_api_steps.rb
trema-0.6.0 features/step_definitions/rest_api_steps.rb
pio-0.26.0 features/step_definitions/rest_api_steps.rb