spec/rails_spec.rb in logstash-logger-0.7.0 vs spec/rails_spec.rb in logstash-logger-0.8.0
- old
+ new
@@ -20,11 +20,11 @@
let(:app) { Rails.application }
let(:config) { app.config }
subject { app.config.logger }
before(:each) do
- app.config.logstash.clear
+ app.config.logstash = ActiveSupport::OrderedOptions.new
app.config.logger = nil
end
describe '#setup' do
context "when configured with a port" do
@@ -47,9 +47,32 @@
LogStashLogger.setup(app)
end
it "configures the logger using the URI" do
expect(subject.device).to be_a LogStashLogger::Device::TCP
+ end
+ end
+
+ context "when configured with multiple devices" do
+ before(:each) do
+ app.config.logstash = [
+ {
+ type: :udp,
+ uri: udp_uri
+ },
+ {
+ type: :file
+ }
+ ]
+ LogStashLogger.setup(app)
+ end
+
+ it "uses a multi-delegator" do
+ expect(subject.device).to be_a LogStashLogger::Device::MultiDelegator
+ expect(subject.device.devices.map(&:class)).to eq([
+ LogStashLogger::Device::UDP,
+ LogStashLogger::Device::File
+ ])
end
end
context "when logstash is not configured" do
before(:each) do