Sha256: 5683da857be1669063187b072045a3d7424c537cb6f13f0b0d3885a99fe11585
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require "spec_helper" describe Timber::LogLine do let(:message) { "this is a message" } let(:log_line) { described_class.new(message) } around(:each) do |example| heroku = Timber::Contexts::Servers::HerokuSpecific.new("web.1") Timber::CurrentContext.add(heroku) { example.run } end describe "#initialize" do subject { log_line } its(:dt) { should_not be_nil } its(:message) { should equal(message) } context "non string" do let(:message) { :"this is a message" } its(:message) { should eq(message.to_s) } end context "exceeds bytesize limit" do let(:limit) { Timber::APISettings::MESSAGE_BYTE_SIZE_MAX } let(:message) { (1..(limit + 1)).collect { "A" }.join } its(:message) { should_not eq(message) } its(:message) { should eq(message.byteslice(0, Timber::APISettings::MESSAGE_BYTE_SIZE_MAX)) } end it "notifies CurrentLineIndexes" do expect(Timber::CurrentLineIndexes).to receive(:log_line_added).once subject end end describe "#to_json" do # Note: very important that we keep the iso8601 format. Otherwise the Timber API # will recognized the date as invalid. let(:as_json) do { dt: log_line.dt.iso8601(6), message: log_line.message, }.merge(log_line.context_snapshot.as_json) end let(:json) { as_json.to_json } subject { log_line.to_json } it { should eq(json) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timberio-1.0.0.beta1 | spec/timber/log_line_spec.rb |