Sha256: ae322780743e5fa7b4cc2a903e7ac7fede2c50f90716be645e7008a96947f5ec

Contents?: true

Size: 716 Bytes

Versions: 6

Compression:

Stored size: 716 Bytes

Contents

module RSpec
  module Mocks
    # @private
    class OrderGroup
      def initialize error_generator
        @error_generator = error_generator
        @ordering = Array.new
      end

      # @private
      def register(expectation)
        @ordering << expectation
      end

      # @private
      def ready_for?(expectation)
        return @ordering.first == expectation
      end

      # @private
      def consume
        @ordering.shift
      end

      # @private
      def handle_order_constraint expectation
        return unless @ordering.include? expectation
        return consume if ready_for?(expectation)
        @error_generator.raise_out_of_order_error expectation.sym
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.8.0/lib/rspec/mocks/order_group.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.8.0/lib/rspec/mocks/order_group.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-mocks-2.8.0/lib/rspec/mocks/order_group.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-mocks-2.8.0/lib/rspec/mocks/order_group.rb
rspec-mocks-2.8.0 lib/rspec/mocks/order_group.rb
rspec-mocks-2.8.0.rc2 lib/rspec/mocks/order_group.rb