Sha256: c4e23fb70302f5ccba96d9b47ebb015200748f1bf8f37182029399862cf52863

Contents?: true

Size: 994 Bytes

Versions: 14

Compression:

Stored size: 994 Bytes

Contents

# encoding: utf-8
require_relative "../spec_helper"

describe LogStash::Outputs::Mongodb, :integration => true do

  let(:uri)        { 'mongodb://localhost:27017' }
  let(:database)   { 'logstash' }
  let(:collection) { 'logs' }
  let(:uuid)       { SecureRandom.uuid }

  let(:config) do
    { "uri" => uri, "database" => database,
      "collection" => collection, "isodate" => true }
  end

  describe "#send" do

    subject { LogStash::Outputs::Mongodb.new(config) }

    let(:properties) { { "message" => "This is a message!",
                         "uuid" => uuid, "number" => BigDecimal.new("4321.1234"),
                         "utf8" => "żółć", "int" => 42,
                         "arry" => [42, "string", 4321.1234]} }
    let(:event)      { LogStash::Event.new(properties) }

    before(:each) do
      subject.register
    end

    it "should send the event to the database" do
      subject.receive(event)
      expect(subject).to have_received(event)
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
logstash-output-mongodb-3.1.7 spec/integration/mongodb_spec.rb
logstash-output-mongodb_custom-0.1.0 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.6 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.5 spec/integration/mongodb_spec.rb
logstash-output-mongodb_3.6-3.1.5 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.4 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.3 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.2 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.1 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.1.0 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.0.1 spec/integration/mongodb_spec.rb
logstash-output-mongodb-3.0.0 spec/integration/mongodb_spec.rb
logstash-output-mongodb-2.0.5 spec/integration/mongodb_spec.rb
logstash-output-mongodb-2.0.3 spec/integration/mongodb_spec.rb