Sha256: 7f607928f96bb531999ad303dd481332082a095138baa303ff6e677e19713452

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 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

2 entries across 2 versions & 1 rubygems

Version Path
fozzie-1.1.0 spec/lib/fozzie/bulk_dsl_spec.rb
fozzie-1.0.3 spec/lib/fozzie/bulk_dsl_spec.rb