Clean up specs
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -51,6 +51,8 @@ gem "image_processing", "~> 1.0"
|
|||||||
|
|
||||||
gem "sentry-ruby"
|
gem "sentry-ruby"
|
||||||
|
|
||||||
|
gem "warning"
|
||||||
|
|
||||||
group :cli, :development do
|
group :cli, :development do
|
||||||
gem "hanami-reloader"
|
gem "hanami-reloader"
|
||||||
end
|
end
|
||||||
|
@@ -443,6 +443,7 @@ GEM
|
|||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.8.2)
|
unf_ext (0.0.8.2)
|
||||||
unicode-display_width (2.4.2)
|
unicode-display_width (2.4.2)
|
||||||
|
warning (1.3.0)
|
||||||
webmention (7.0.0)
|
webmention (7.0.0)
|
||||||
http (~> 5.0)
|
http (~> 5.0)
|
||||||
indieweb-endpoints (~> 8.0)
|
indieweb-endpoints (~> 8.0)
|
||||||
@@ -508,6 +509,7 @@ DEPENDENCIES
|
|||||||
standardrb
|
standardrb
|
||||||
time_math2
|
time_math2
|
||||||
timecop
|
timecop
|
||||||
|
warning
|
||||||
webmention
|
webmention
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
|
@@ -6,7 +6,7 @@ require "httparty"
|
|||||||
require "dry-monads"
|
require "dry-monads"
|
||||||
require "dry-matcher"
|
require "dry-matcher"
|
||||||
require "dry/matcher/result_matcher"
|
require "dry/matcher/result_matcher"
|
||||||
|
require "pry"
|
||||||
module Adamantium
|
module Adamantium
|
||||||
class Action < Hanami::Action
|
class Action < Hanami::Action
|
||||||
include Deps["logger",
|
include Deps["logger",
|
||||||
@@ -22,6 +22,8 @@ module Adamantium
|
|||||||
handle_exception StandardError => :handle_error
|
handle_exception StandardError => :handle_error
|
||||||
|
|
||||||
def authenticate!(req, res)
|
def authenticate!(req, res)
|
||||||
|
halt 400 if req.env["HTTP_AUTHORIZATION"] && req.params[:access_token]
|
||||||
|
|
||||||
if Hanami.env == :development || Hanami.env == :test
|
if Hanami.env == :development || Hanami.env == :test
|
||||||
req.env[:scopes] = verify_token(nil)
|
req.env[:scopes] = verify_token(nil)
|
||||||
return true
|
return true
|
||||||
@@ -29,8 +31,6 @@ module Adamantium
|
|||||||
|
|
||||||
# Pull out and verify the authorization header or access_token
|
# Pull out and verify the authorization header or access_token
|
||||||
|
|
||||||
halt 400 if req.env["HTTP_AUTHORIZATION"] && req.params["access_token"]
|
|
||||||
|
|
||||||
if req.env["HTTP_AUTHORIZATION"]
|
if req.env["HTTP_AUTHORIZATION"]
|
||||||
header = req.env["HTTP_AUTHORIZATION"].match(/Bearer (.*)$/)
|
header = req.env["HTTP_AUTHORIZATION"].match(/Bearer (.*)$/)
|
||||||
access_token = header[1] unless header.nil?
|
access_token = header[1] unless header.nil?
|
||||||
|
@@ -159,17 +159,12 @@ RSpec.describe "Post creation", :db, :requests do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "auth" do
|
context "auth" do
|
||||||
xit "does not allow multiple auth methods" do
|
it "does not allow multiple auth methods" do
|
||||||
params = {
|
params = {
|
||||||
access_token: "foo"
|
access_token: "foo"
|
||||||
}
|
}
|
||||||
|
|
||||||
headers = {
|
post "/micropub", params, "HTTP_AUTHORIZATION" => "Bearer foo"
|
||||||
HTTP_AUTHORIZATION: "Bearer foo",
|
|
||||||
CONTENT_TYPE: "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
post "/micropub", params.to_json, headers
|
|
||||||
|
|
||||||
expect(last_response.status).to eq 400
|
expect(last_response.status).to eq 400
|
||||||
end
|
end
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
RSpec.describe Admin::Action do
|
|
||||||
xit "works"
|
|
||||||
end
|
|
@@ -1,6 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
require "warning"
|
||||||
SPEC_ROOT = Pathname(__dir__).realpath.freeze
|
SPEC_ROOT = Pathname(__dir__).realpath.freeze
|
||||||
|
|
||||||
ENV["HANAMI_ENV"] ||= "test"
|
ENV["HANAMI_ENV"] ||= "test"
|
||||||
@@ -10,3 +11,7 @@ require "timecop"
|
|||||||
|
|
||||||
require_relative "support/rspec"
|
require_relative "support/rspec"
|
||||||
require_relative "support/feature_loader"
|
require_relative "support/feature_loader"
|
||||||
|
|
||||||
|
Gem.path.each do |path|
|
||||||
|
Warning.ignore(//, path)
|
||||||
|
end
|
Reference in New Issue
Block a user