Sha256: 016bbaaa650dfd56888b540b9f72111cc506406558b61693bf80550a5264f988

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module Logux
  module Test
    class << self
      attr_accessor :http_requests_enabled

      def enable_http_requests!
        raise ArgumentError unless block_given?

        begin
          self.http_requests_enabled = true
          yield
        ensure
          self.http_requests_enabled = false
        end
      end
    end

    module Client
      def post(params)
        if Logux::Test.http_requests_enabled
          super(params)
        else
          Logux::Test::Store.instance.add(params.to_json)
        end
      end
    end

    autoload :Helpers, 'logux/test/helpers'
    autoload :Store, 'logux/test/store'
    autoload :Matchers, 'logux/test/matchers'
  end
end
Logux::Client.prepend Logux::Test::Client

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
logux-rack-0.1.0 lib/logux/test.rb
logux_rails-0.1.0 lib/logux/test.rb