Skip to content

Commit 37a1bc2

Browse files
committed
Merge pull request #325 from kbrock/batcher_specs
fix missing parameters in item_batcher_spec
2 parents 83de784 + 5a68729 commit 37a1bc2

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

spec/workflow/item_batcher_spec.rb

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,25 @@
5252
end
5353

5454
context "with MaxInputBytesPerBatch" do
55-
let(:payload) { {"MaxInputBytesPerBatch" => 1_024} }
55+
let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024} }
5656

5757
it "returns an ItemBatcher" do
58-
pending "implement MaxInputBytesPerBatch"
5958
expect(subject).to be_kind_of(described_class)
6059
end
6160

6261
it "sets max_input_bytes_per_batch" do
63-
pending "implement MaxInputBytesPerBatch"
64-
6562
expect(subject.max_input_bytes_per_batch).to eq(payload["MaxInputBytesPerBatch"])
6663
end
6764

6865
context "that is an invalid value" do
6966
it "raises an exception" do
70-
pending "implement MaxInputBytesPerBatch"
71-
72-
expect { described_class.new({"MaxInputBytesPerBatch" => 0}, ["Map", "ItemBatcher"]) }
67+
expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 0}, ["Map", "ItemBatcher"]) }
7368
.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"0\" must be a positive integer")
74-
expect { described_class.new({"MaxInputBytesPerBatch" => -1}, ["Map", "ItemBatcher"]) }
69+
expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => -1}, ["Map", "ItemBatcher"]) }
7570
.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"-1\" must be a positive integer")
76-
expect { described_class.new({"MaxInputBytesPerBatch" => 2.5}, ["Map", "ItemBatcher"]) }
71+
expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 2.5}, ["Map", "ItemBatcher"]) }
7772
.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"2.5\" must be a positive integer")
78-
expect { described_class.new({"MaxInputBytesPerBatch" => "1"}, ["Map", "ItemBatcher"]) }
73+
expect { described_class.new({"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => "1"}, ["Map", "ItemBatcher"]) }
7974
.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher field \"MaxInputBytesPerBatch\" value \"1\" must be a positive integer")
8075
end
8176
end
@@ -95,17 +90,13 @@
9590
end
9691

9792
context "with MaxInputBytesPerBatchPath" do
98-
let(:payload) { {"MaxInputBytesPerBatchPath" => "$.batchSize"} }
93+
let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatchPath" => "$.batchSize"} }
9994

10095
it "returns an ItemBatcher" do
101-
pending "implement MaxInputBytesPerBatchPath"
102-
10396
expect(subject).to be_kind_of(described_class)
10497
end
10598

10699
it "sets max_input_bytes_per_batch_path" do
107-
pending "implement MaxInputBytesPerBatchPath"
108-
109100
expect(subject.max_input_bytes_per_batch_path).to be_kind_of(Floe::Workflow::ReferencePath)
110101
expect(subject.max_input_bytes_per_batch_path).to have_attributes(:path => ["batchSize"])
111102
end
@@ -120,11 +111,9 @@
120111
end
121112

122113
context "with MaxInputBytesPerBatch and MaxInputBytesPerBatchPath" do
123-
let(:payload) { {"MaxInputBytesPerBatch" => 1_024, "MaxInputBytesPerBatchPath" => "$.batchSize"} }
114+
let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024, "MaxInputBytesPerBatchPath" => "$.batchSize"} }
124115

125116
it "raises an exception" do
126-
pending "implement MaxInputBytesPerBatchPath"
127-
128117
expect { subject }.to raise_error(Floe::InvalidWorkflowError, "Map.ItemBatcher must not specify both \"MaxInputBytesPerBatch\" and \"MaxInputBytesPerBatchPath\"")
129118
end
130119
end
@@ -165,7 +154,7 @@
165154
end
166155

167156
context "with MaxInputBytesPerBatch" do
168-
let(:payload) { {"MaxInputBytesPerBatch" => 1_024} }
157+
let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatch" => 1_024} }
169158

170159
it "returns in batches of 2" do
171160
pending "support max bytes per batch"
@@ -175,7 +164,7 @@
175164
end
176165

177166
context "with MaxInputBytesPerBatchPath" do
178-
let(:payload) { {"MaxInputBytesPerBatchPath" => "$.bytesPerBatch"} }
167+
let(:payload) { {"MaxItemsPerBatch" => 10, "MaxInputBytesPerBatchPath" => "$.bytesPerBatch"} }
179168
let(:state_input) { {"bytesPerBatch" => 1_024, "items" => input} }
180169

181170
it "returns in batches of 2" do
@@ -185,7 +174,7 @@
185174
end
186175

187176
context "with an invalid value in input" do
188-
let(:state_input) { {"bytesPerBatch" => 0, "items" => input} }
177+
let(:state_input) { {"MaxItemsPerBatch" => 10, "bytesPerBatch" => 0, "items" => input} }
189178

190179
it "raises an exception" do
191180
pending "support max bytes per batch"

0 commit comments

Comments
 (0)