spec/timber/log_devices/http_spec.rb in timber-1.0.13 vs spec/timber/log_devices/http_spec.rb in timber-1.1.0
- old
+ new
@@ -56,19 +56,19 @@
describe "#flush" do
let(:time) { Time.utc(2016, 9, 1, 12, 0, 0) }
it "should add a request to the queue" do
http = described_class.new("MYKEY", threads: false)
- log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 1", nil, nil)
+ log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 1", nil, nil, [])
http.write(log_entry)
- log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 2", nil, nil)
+ log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 2", nil, nil, [])
http.write(log_entry)
http.send(:flush)
request_queue = http.instance_variable_get(:@request_queue)
request = request_queue.deq
expect(request).to be_kind_of(Net::HTTP::Post)
- expect(request.body).to eq("\x92\x83\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 1\x83\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 2".force_encoding("ASCII-8BIT"))
+ expect(request.body).to start_with("\x92\x85\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 1\xA7context\x81".force_encoding("ASCII-8BIT"))
message_queue = http.instance_variable_get(:@msg_queue)
expect(message_queue.size).to eq(0)
end
@@ -96,23 +96,23 @@
let(:time) { Time.utc(2016, 9, 1, 12, 0, 0) }
it "should start a intervaled flush thread and flush on an interval" do
stub = stub_request(:post, "https://logs.timber.io/frames").
with(
- :body => "\x92\x83\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 1\x83\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 2".force_encoding("ASCII-8BIT"),
+ :body => start_with("\x92\x85\xA5level\xA4INFO\xA2dt\xBB2016-09-01T12:00:00.000000Z\xA7message\xB2test log message 1\xA7context\x81\xA6system".force_encoding("ASCII-8BIT")),
:headers => {
'Accept' => 'application/json',
'Authorization' => 'Basic TVlLRVk=',
'Content-Type' => 'application/msgpack',
- 'User-Agent' => "Timber Ruby Gem/#{Timber::VERSION}"
+ 'User-Agent' => "Timber Ruby/#{Timber::VERSION} (HTTP)"
}
).
to_return(:status => 200, :body => "", :headers => {})
http = described_class.new("MYKEY", flush_interval: 0.1)
- log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 1", nil, nil)
+ log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 1", nil, nil, [])
http.write(log_entry)
- log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 2", nil, nil)
+ log_entry = Timber::LogEntry.new("INFO", time, nil, "test log message 2", nil, nil, [])
http.write(log_entry)
sleep 0.3
expect(stub).to have_been_requested.times(1)
end
\ No newline at end of file