diff --git a/skyetel/app.rb b/skyetel/app.rb index 586089d..c78ef59 100644 --- a/skyetel/app.rb +++ b/skyetel/app.rb @@ -1,21 +1,9 @@ -require "logger" require_relative "config/application" module App class Handler - attr_reader :event, :context - - def self.process(event:, context:) - logger = Logger.new($stdout) - logger.info("## Processing Event") - logger.info(event) - - new(event:, context:).process - end - - def initialize(event:, context:) - @event = event - @context = context + def self.process(**) + new.process end def process diff --git a/skyetel/spec/app_spec.rb b/skyetel/spec/app_spec.rb index 54b3543..d46ba22 100644 --- a/skyetel/spec/app_spec.rb +++ b/skyetel/spec/app_spec.rb @@ -37,15 +37,10 @@ module App :post, "https://api.somleng.org/carrier/v1/phone_numbers", response_body: file_fixture("somleng/responses/create_phone_number.json").read ) - handler = build_handler - handler.process + App::Handler.process(event: {}, context: double("LambdaContext", as_json: {})) expect(a_request(:post, "https://api.somleng.org/carrier/v1/phone_numbers")).to have_been_made.times(2) end - - def build_handler(**options) - Handler.new(event: {}, context: double("LambdaContext", as_json: {}), **options) - end end end diff --git a/skyetel/spec/support/lambda_helpers.rb b/skyetel/spec/support/lambda_helpers.rb deleted file mode 100644 index ebccdd3..0000000 --- a/skyetel/spec/support/lambda_helpers.rb +++ /dev/null @@ -1,11 +0,0 @@ -module LambdaHelpers - def invoke_lambda(payload:) - context = double("LambdaContext", as_json: {}) - - App::Handler.process(event: payload, context:) - end -end - -RSpec.configure do |config| - config.include(LambdaHelpers) -end