Sha256: 2494f24277752b4af288d39233f0816c56f88bb12026d9c58889a787e87f586c

Contents?: true

Size: 931 Bytes

Versions: 6

Compression:

Stored size: 931 Bytes

Contents

require "spec_helper"

describe Shamu::Auditing::LoggingAuditingService do
  let( :service ) { scorpion.new Shamu::Auditing::LoggingAuditingService }

  it "writes to the logger" do
    expect( service.logger ).to receive( :unknown )

    transaction = Shamu::Auditing::Transaction.new \
      user_id_chain: [1, 2, 3],
      action: :change,
      changes: { name: "Mr Penguin" }

    transaction.append_entity [ "User", 45 ]

    service.commit transaction
  end

  it "filters protected keys" do
    expect( service.logger ).to receive( :unknown ) do |message|
      expect( message ).not_to match "I'm a secret"
      expect( message ).to match "Mr Penguin"
    end

    transaction = Shamu::Auditing::Transaction.new \
      user_id_chain: [1, 2, 3],
      action: :change,
      changes: { name: "Mr Penguin", password: "I'm a secret" }

    transaction.append_entity [ "User", 45 ]

    service.commit transaction
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shamu-0.0.24 spec/lib/shamu/auditing/logging_auditing_service_spec.rb
shamu-0.0.21 spec/lib/shamu/auditing/logging_auditing_service_spec.rb
shamu-0.0.20 spec/lib/shamu/auditing/logging_auditing_service_spec.rb
shamu-0.0.19 spec/lib/shamu/auditing/logging_auditing_service_spec.rb
shamu-0.0.18 spec/lib/shamu/auditing/logging_auditing_service_spec.rb
shamu-0.0.17 spec/lib/shamu/auditing/logging_auditing_service_spec.rb