From ab39504aa7c1963169f04e750b7a458db9d1e5ab Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Wed, 17 Jan 2018 20:41:50 +0100 Subject: Add dummy API delete endpoint with feature spec --- lib/api/api.rb | 1 + lib/api/something.rb | 13 +++++++++++++ spec/features/dummy_spec.rb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 lib/api/something.rb create mode 100644 spec/features/dummy_spec.rb diff --git a/lib/api/api.rb b/lib/api/api.rb index ae161efb358..38cc81d3168 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -147,6 +147,7 @@ module API mount ::API::Runners mount ::API::Services mount ::API::Settings + mount ::API::Something mount ::API::SidekiqMetrics mount ::API::Snippets mount ::API::Subscriptions diff --git a/lib/api/something.rb b/lib/api/something.rb new file mode 100644 index 00000000000..6cf9126c861 --- /dev/null +++ b/lib/api/something.rb @@ -0,0 +1,13 @@ +module API + class Something < Grape::API + resource :something do + desc 'Delete something' + params do + + end + delete do + status 204 + end + end + end +end diff --git a/spec/features/dummy_spec.rb b/spec/features/dummy_spec.rb new file mode 100644 index 00000000000..4ede61cc041 --- /dev/null +++ b/spec/features/dummy_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' +require 'net/http' + +feature 'dummy feature' do + scenario 'deletes something', :js do + visit root_path + + url = URI.parse(evaluate_script('location.origin') + '/api/v4/something') + req = Net::HTTP::Delete.new(url.to_s) + res = Net::HTTP.start(url.host, url.port) {|http| + http.request(req) + } + + puts res.code + puts res.body + end + + scenario 'deletes something with JavaScript', :js do + visit root_path + + url = URI.parse(evaluate_script('location.origin') + '/api/v4/something') + req = Net::HTTP::Delete.new(url.to_s) + res = Net::HTTP.start(url.host, url.port) {|http| + http.request(req) + } + + puts res.code + puts res.body + end +end -- cgit v1.2.1