Skip to content

Commit

Permalink
Fix auto correct quotes and spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nd4p90x committed May 28, 2024
1 parent 6ede327 commit bdf9d9d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spec/segment/analytics/message_batch_spec.rb
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# frozen_string_literal: true

require "spec_helper"
require 'spec_helper'

module Segment
class Analytics
describe MessageBatch do
subject { described_class.new(100) }

describe "#<<" do
it "appends messages" do
describe '#<<' do
it 'appends messages' do
expect(subject.length).to eq(0)

subject << {"a" => "b"}
subject << { 'a' => 'b' }

expect(subject.length).to eq(1)
end

it "rejects messages that exceed the maximum allowed size" do
it 'rejects messages that exceed the maximum allowed size' do
max_bytes = Defaults::Message::MAX_BYTES
message = {"a" => "b" * max_bytes}
message = { 'a' => 'b' * max_bytes }

expect(subject.length).to eq(0)

expect { subject << message }.to raise_error(MessageBatch::JSONGenerationError)
.with_message("Message Exceeded Maximum Allowed Size")
.with_message('Message Exceeded Maximum Allowed Size')
end
end

describe "#full?" do
it "returns true once item count is exceeded" do
99.times { subject << {a: "b"} }
describe '#full?' do
it 'returns true once item count is exceeded' do
99.times { subject << { a: 'b' } }
expect(subject.full?).to be(false)

subject << {a: "b"}
subject << { a: 'b' }
expect(subject.full?).to be(true)
end

it "returns true once max size is almost exceeded" do
message = {a: "b" * (Defaults::Message::MAX_BYTES - 10)}
it 'returns true once max size is almost exceeded' do
message = { a: "b" * (Defaults::Message::MAX_BYTES - 10) }

message_size = message.to_json.bytesize

Expand Down

0 comments on commit bdf9d9d

Please sign in to comment.