From 1fd6be3a41dfdccd33885a2a40424ff75112df7f Mon Sep 17 00:00:00 2001 From: Rick Song Date: Thu, 15 Nov 2018 09:38:48 +0800 Subject: [PATCH] upgrade gems and fix errors according to changes from upstream --- lib/okcomputer/grape/api.rb | 6 +++--- lib/okcomputer/grape/version.rb | 2 +- okcomputer-grape.gemspec | 10 +++++----- spec/okcomputer/grape/api_spec.rb | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/okcomputer/grape/api.rb b/lib/okcomputer/grape/api.rb index baeed0d..a128db3 100644 --- a/lib/okcomputer/grape/api.rb +++ b/lib/okcomputer/grape/api.rb @@ -12,9 +12,9 @@ class Api < ::Grape::API formatter :txt, ->(object, env){ object.to_text } formatter :html, ->(object, env){ object.to_text } - error_formatter :json, ->(message, backtrace, options, env) { { error: message.to_s }.to_json } - error_formatter :txt, ->(message, backtrace, options, env) { message } - error_formatter :html, ->(message, backtrace, options, env) { message } + error_formatter :json, ->(message, backtrace, options, env, original_exception) { { error: message.to_s }.to_json } + error_formatter :txt, ->(message, backtrace, options, env, original_exception) { message } + error_formatter :html, ->(message, backtrace, options, env, original_exception) { message } rescue_from OkComputer::Registry::CheckNotFound do |exception| error!(exception, 404) diff --git a/lib/okcomputer/grape/version.rb b/lib/okcomputer/grape/version.rb index b6643e2..3f16b5a 100644 --- a/lib/okcomputer/grape/version.rb +++ b/lib/okcomputer/grape/version.rb @@ -1,5 +1,5 @@ module Okcomputer module Grape - VERSION = "0.1.0" + VERSION = "0.1.1" end end diff --git a/okcomputer-grape.gemspec b/okcomputer-grape.gemspec index 11da10d..a573daa 100644 --- a/okcomputer-grape.gemspec +++ b/okcomputer-grape.gemspec @@ -19,11 +19,11 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_runtime_dependency "grape" - spec.add_runtime_dependency "okcomputer", ">= 1.6.6" + spec.add_runtime_dependency "grape", "~> 1" + spec.add_runtime_dependency "okcomputer", "~> 1" - spec.add_development_dependency "bundler", "~> 1.11" - spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "bundler", "~> 1.0" + spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rack-test" + spec.add_development_dependency "rack-test", "~> 1.0" end diff --git a/spec/okcomputer/grape/api_spec.rb b/spec/okcomputer/grape/api_spec.rb index c91f686..06cdacc 100644 --- a/spec/okcomputer/grape/api_spec.rb +++ b/spec/okcomputer/grape/api_spec.rb @@ -140,13 +140,13 @@ def app it "returns a 404 if the check does not exist" do get "/non-existent", format: :txt - last_response.body.should == "No check registered with 'non-existent'" + last_response.body.should == "No matching check" last_response.status.should == 404 end it "returns a JSON 404 if the check does not exist" do get "/non-existent", format: :json - last_response.body.should == { error: "No check registered with 'non-existent'" }.to_json + last_response.body.should == { error: "No matching check" }.to_json last_response.status.should == 404 end end