Sha256: 7161e527bc7f35b55583932766c9c02027d8f3a12f60981bdc5aba8fb47bdb0d
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' module Alf module Operator::Relational describe Quota do let(:operator_class){ Quota } it_should_behave_like("An operator class") let(:input) {[ {:a => "via_method", :time => 1}, {:a => "via_method", :time => 2}, {:a => "via_method", :time => 3}, {:a => "via_reader", :time => 4}, {:a => "via_reader", :time => 2}, ]} let(:expected) {[ {:a => "via_method", :time => 1, :time_sum => 1, :time_max => 1}, {:a => "via_method", :time => 2, :time_sum => 3, :time_max => 2}, {:a => "via_method", :time => 3, :time_sum => 6, :time_max => 3}, {:a => "via_reader", :time => 2, :time_sum => 2, :time_max => 2}, {:a => "via_reader", :time => 4, :time_sum => 6, :time_max => 4}, ]} subject{ operator.to_a } context "with Lispy" do let(:aggs){{:time_sum => Aggregator.sum{ time }, :time_max => Aggregator.max{ time }}} let(:operator){ Lispy.quota(input, [:a], [:time], aggs) } it { should == expected } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems