Sha256: ff931c1b68a37892c4eb4fb088d6ab8e5e8db12a7904489a3e1e2181d49d77e7

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

ENV['ELASTICSEARCH_URL'] = Rails.application.credentials.elasticsearch_url

require 'faraday'



module Paragraphs
  class << self
    def report_paragraph_infraction(id)
      fail "§#{id} was infringed"
    end
  end
  
  class DropboxApiCheckFaradayMiddleware < Faraday::Response::Middleware
    def on_complete(env)
      if env.body.empty?
        Paragraphs.report_paragraph_infraction(ASSERT_NO_DROPBOX_API_ERRORS)
      end
    end
  end

  
    NOT_DELETE_BEFORE_100_TEST_COVERAGE = 0
    STILL_FAILS_SADLY = 1
    ASSERT_NO_DROPBOX_API_ERRORS = 2
    CHECK_FOR_TEMPFILE_NOT_REWINDED_ISSUE = 3
    TEMPFILES_MUST_BE_SUPPORTED = 4
    
    def §(*paragraph_constants)
      # if(paragraph_constants.include?(TEMPFILES_MUST_BE_SUPPORTED))
      #   t = Tempfile.new
      #   t.write("test")
      #   t.rewind
      #   unless t.read == "test"
      #     Paragraphs.report_paragraph_infraction(TEMPFILES_MUST_BE_SUPPORTED)
      #   end
      # end
      
      # if(paragraph_constants.include?(ASSERT_NO_DROPBOX_API_ERRORS))
      #
      #   Faraday::Connection.class_eval do
      #     alias_method :original_initialize, :initialize
      #     def initialize(*args, &block)
      #       original_initialize(*args, &block)
      #
      #       self.use(DropboxApiCheckFaradayMiddleware)
      #     end
      #   end
      #
      # end
      
      yield if block_given?
    end
end

class Object
    include Paragraphs
end

# Load the Rails application.
require_relative 'application'

# Initialize the Rails application.
Rails.application.initialize!

ENV['ELASTICSEARCH_URL'] = Rails.application.credentials.elasticsearch_url

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jester-data-8.0.0 config/environment.rb