1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Disable moneky patching with RSpec

This commit is contained in:
Holger Just 2018-02-15 16:03:13 +01:00
parent 8c9b564f54
commit dab393ee21
48 changed files with 84 additions and 81 deletions

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/adapter/base_adapter'
describe Rackstash::Adapter::BaseAdapter do
RSpec.describe Rackstash::Adapter::BaseAdapter do
let(:adapter) { described_class.new }
describe '.parse_uri_options' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/adapter/callable'
describe Rackstash::Adapter::Callable do
RSpec.describe Rackstash::Adapter::Callable do
let(:callable) { ->(log) { log } }
let(:adapter) { described_class.new(callable) }

View File

@ -11,7 +11,7 @@ require 'tmpdir'
require 'rackstash/adapter/file'
describe Rackstash::Adapter::File do
RSpec.describe Rackstash::Adapter::File do
let!(:logfile) { Tempfile.new('') }
let(:adapter_args) { {} }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -11,7 +11,7 @@ require 'tempfile'
require 'rackstash/adapter/io'
describe Rackstash::Adapter::IO do
RSpec.describe Rackstash::Adapter::IO do
let(:io) { StringIO.new }
let(:adapter) { described_class.new(io) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -10,7 +10,7 @@ require 'stringio'
require 'rackstash/adapter/logger'
describe Rackstash::Adapter::Logger do
RSpec.describe Rackstash::Adapter::Logger do
let(:bucket) {
Struct.new(:lines) do
def initialize(*args)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/adapter/null'
describe Rackstash::Adapter::Null do
RSpec.describe Rackstash::Adapter::Null do
let(:adapter) { described_class.new }
describe '#initialize' do

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/adapter'
describe Rackstash::Adapter do
RSpec.describe Rackstash::Adapter do
around(:each) do |example|
types = described_class.send(:adapter_types)
schemes = described_class.send(:adapter_schemes)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/buffer'
describe Rackstash::Buffer do
RSpec.describe Rackstash::Buffer do
let(:buffer_options) { {} }
let(:flows) { instance_double(Rackstash::Flows) }
let(:buffer) { described_class.new(flows, **buffer_options) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/buffer_stack'
describe Rackstash::BufferStack do
RSpec.describe Rackstash::BufferStack do
let(:flows) { instance_double(Rackstash::Flows) }
let(:stack) { described_class.new(flows) }

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/class_registry'
describe Rackstash::ClassRegistry do
RSpec.describe Rackstash::ClassRegistry do
let(:registry) { described_class.new('value') }
let(:klass) { Class.new }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/hash'
describe Rackstash::Encoder::Hash do
RSpec.describe Rackstash::Encoder::Hash do
let(:encoder) { described_class.new }
describe '#encode' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/helper/message'
describe Rackstash::Encoder::Helper::Message do
RSpec.describe Rackstash::Encoder::Helper::Message do
let(:helper) {
helper = Object.new.extend(described_class)
described_class.private_instance_methods(false).each do |method|

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/helper/timestamp'
describe Rackstash::Encoder::Helper::Timestamp do
RSpec.describe Rackstash::Encoder::Helper::Timestamp do
let(:helper) {
helper = Object.new.extend(described_class)
described_class.private_instance_methods(false).each do |method|

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/json'
describe Rackstash::Encoder::JSON do
RSpec.describe Rackstash::Encoder::JSON do
let(:encoder) { described_class.new }
describe '#encode' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/lograge'
describe Rackstash::Encoder::Lograge do
RSpec.describe Rackstash::Encoder::Lograge do
let(:encoder) { described_class.new }
describe '#encode' do

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/logstash'
describe Rackstash::Encoder::Logstash do
RSpec.describe Rackstash::Encoder::Logstash do
let(:encoder) { described_class.new }
describe '#encode' do

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/message'
describe Rackstash::Encoder::Message do
RSpec.describe Rackstash::Encoder::Message do
let(:tagged) { [] }
let(:encoder) { described_class.new(tagged: tagged) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/encoder/raw'
describe Rackstash::Encoder::Raw do
RSpec.describe Rackstash::Encoder::Raw do
let(:encoder) { described_class.new }
describe '#encode' do

View File

@ -10,7 +10,7 @@ require 'securerandom'
require 'rackstash/encoder'
describe Rackstash::Encoder do
RSpec.describe Rackstash::Encoder do
let(:registry) { Rackstash::ClassRegistry.new('encoder') }
let(:encoder_class) {

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -11,7 +11,7 @@ require 'rackstash/fields/abstract_collection'
require 'rackstash/fields/array'
require 'rackstash/fields/hash'
describe Rackstash::Fields::AbstractCollection do
RSpec.describe Rackstash::Fields::AbstractCollection do
let(:collection) { described_class.new }
def normalize(*args)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/fields/array'
describe Rackstash::Fields::Array do
RSpec.describe Rackstash::Fields::Array do
let(:array) { described_class.new }
describe '#+' do

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/fields/hash'
describe Rackstash::Fields::Hash do
RSpec.describe Rackstash::Fields::Hash do
let(:forbidden_keys) { Set.new }
let(:hash) { Rackstash::Fields::Hash.new(forbidden_keys: forbidden_keys) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/fields/tags'
describe Rackstash::Fields::Tags do
RSpec.describe Rackstash::Fields::Tags do
let(:tags) { described_class.new }
describe '#<<' do

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/anonymize_ip_mask'
describe Rackstash::Filter::AnonymizeIPMask do
RSpec.describe Rackstash::Filter::AnonymizeIPMask do
let(:event) {
{
'ipv4' => '10.123.42.65',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/clear_color'
describe Rackstash::Filter::ClearColor do
RSpec.describe Rackstash::Filter::ClearColor do
let(:filter) { described_class.new }
it 'removes any ANSI color codes from the message' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/default_fields'
describe Rackstash::Filter::DefaultFields do
RSpec.describe Rackstash::Filter::DefaultFields do
let(:event) {
{
'foo' => 'v1',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/default_tags'
describe Rackstash::Filter::DefaultTags do
RSpec.describe Rackstash::Filter::DefaultTags do
let(:event) {
{
'key' => 'value'

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/drop_if'
describe Rackstash::Filter::DropIf do
RSpec.describe Rackstash::Filter::DropIf do
describe '#initialize' do
it 'expects a condition' do
expect { described_class.new }.to raise_error ArgumentError

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/remove'
describe Rackstash::Filter::Remove do
RSpec.describe Rackstash::Filter::Remove do
let(:event) {
{
'foo' => 'foo value',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/rename'
describe Rackstash::Filter::Rename do
RSpec.describe Rackstash::Filter::Rename do
let(:event) {
{
'foo' => 'foo value',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/replace'
describe Rackstash::Filter::Replace do
RSpec.describe Rackstash::Filter::Replace do
let(:event) {
{
'foo' => 'foo value',

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/select'
describe Rackstash::Filter::Select do
RSpec.describe Rackstash::Filter::Select do
let(:event) {
{
'foo' => 'foo value',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/truncate_message'
describe Rackstash::Filter::TruncateMessage do
RSpec.describe Rackstash::Filter::TruncateMessage do
let(:max_size) { 36 }
let(:args) { { selectors: [], cut: :bottom } }
let(:filter) { described_class.new(max_size, **args) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter/update'
describe Rackstash::Filter::Update do
RSpec.describe Rackstash::Filter::Update do
let(:event) {
{
'foo' => 'foo value',

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/filter_chain'
describe Rackstash::FilterChain do
RSpec.describe Rackstash::FilterChain do
Struct.new('MyFilter') do
def call(event)
event

View File

@ -10,7 +10,7 @@ require 'securerandom'
require 'rackstash/filter'
describe Rackstash::Filter do
RSpec.describe Rackstash::Filter do
let(:registry) { Rackstash::ClassRegistry.new('filter') }
let(:filter_class) {

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/flow'
describe Rackstash::Flow do
RSpec.describe Rackstash::Flow do
let(:adapter) { Rackstash::Adapter::Null.new }
let(:flow_args) { {} }
let(:flow) { described_class.new(adapter, **flow_args) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -10,7 +10,7 @@ require 'spec_helper'
require 'rackstash/flows'
require 'rackstash/flow'
describe Rackstash::Flows do
RSpec.describe Rackstash::Flows do
let(:flows) { described_class.new }
def a_flow

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -10,7 +10,7 @@ require 'spec_helper'
require 'time'
require 'rackstash/formatter'
describe Rackstash::Formatter do
RSpec.describe Rackstash::Formatter do
let(:formatter) { described_class.new }
it 'formats plain strings' do
@ -59,7 +59,7 @@ describe Rackstash::Formatter do
end
end
describe Rackstash::RawFormatter do
RSpec.describe Rackstash::RawFormatter do
let(:formatter) { described_class.new }
it 'returns the message' do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/helpers/time'
describe Rackstash::Helpers::Time do
RSpec.describe Rackstash::Helpers::Time do
it 'only defines protected methods' do
expect(described_class.public_instance_methods(false)).to be_empty
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/helpers/utf8'
describe Rackstash::Helpers::UTF8 do
RSpec.describe Rackstash::Helpers::UTF8 do
it 'only defines protected methods' do
expect(described_class.public_instance_methods(false)).to be_empty
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/logger'
describe Rackstash::Logger do
RSpec.describe Rackstash::Logger do
let(:target) { StringIO.new }
let(:logger) { described_class.new(target) }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -11,7 +11,7 @@ require 'digest'
require 'json'
require 'rackstash/message'
describe Rackstash::Message do
RSpec.describe Rackstash::Message do
let(:message_args) { {} }
let(:msg) { 'message' }
let(:message) { described_class.new msg, **message_args }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/rack/errors'
describe Rackstash::Rack::Errors do
RSpec.describe Rackstash::Rack::Errors do
let(:logger) { instance_double(Rackstash::Logger) }
let(:errors) { described_class.new(logger) }

View File

@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/rack/middleware'
describe Rackstash::Rack::Middleware do
RSpec.describe Rackstash::Rack::Middleware do
let(:app) {
lambda { |env|
logger = env['rack.logger']

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -9,7 +9,7 @@ require 'spec_helper'
require 'rackstash/version'
describe 'Rackstash::Version' do
RSpec.describe 'Rackstash::Version' do
it 'has a version number' do
expect(Rackstash::Version::STRING).to be_a String
expect(Rackstash::Version::STRING).to equal Rackstash::Version.to_s

View File

@ -1,13 +1,13 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
require 'spec_helper'
describe Rackstash do
RSpec.describe Rackstash do
describe Rackstash::NotImplementedHereError do
it 'inherits from ScriptError' do
expect(described_class.superclass).to equal ScriptError

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#
# Copyright 2017 Holger Just
# Copyright 2017 - 2018 Holger Just
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE.txt file for details.
@ -38,6 +38,9 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'rackstash'
RSpec.configure do |config|
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.mock_with :rspec do |mocks|
# This option should be set when all dependencies are being loaded
# before a spec run, as is the case in a typical spec helper. It will