Sha256: 0e22c9a68ed50abb8a875ee3d31f0afc0aa88ed123f56fb1f56a9fb6c8b546a7

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

require 'spec_helper'

module Fozzie
  describe BulkDsl do

    it_behaves_like "interface"

    describe "#initialize" do

      it "accepts and performs block" do
        BulkDsl.any_instance.should_receive(:foo)

        BulkDsl.new { foo }
      end

    end

    it "sends statistics in one call" do
      Fozzie.c.adapter.should_receive(:register).once

      BulkDsl.new do
        increment :foo
        decrement :bar
      end
    end

    it "scopes given block when arity provided" do
      Fozzie.c.adapter.should_receive(:register).once

      class Foo

        def send_stats
          BulkDsl.new do |s|
            s.increment random_value
            s.decrement random_value
          end
        end

        def random_value; rand end

      end

      Foo.new.send_stats
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fozzie-1.0.2 spec/lib/fozzie/bulk_dsl_spec.rb
fozzie-1.0.1 spec/lib/fozzie/bulk_dsl_spec.rb
fozzie-1.0.0 spec/lib/fozzie/bulk_dsl_spec.rb