Sha256: a621401f4391b9537d671e45ea240d4a9de3bd326eaf902badf02f57f3c573ed

Contents?: true

Size: 663 Bytes

Versions: 158

Compression:

Stored size: 663 Bytes

Contents

module Spec
  module Mocks
    class OrderGroup
      def initialize error_generator
        @error_generator = error_generator
        @ordering = Array.new
      end
      
      def register(expectation)
        @ordering << expectation
      end
      
      def ready_for?(expectation)
        return @ordering.first == expectation
      end
      
      def consume
        @ordering.shift
      end
      
      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

158 entries across 158 versions & 25 rubygems

Version Path
dchelimsky-rspec-1.1.10 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.1 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.2 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.3 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.4 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.5 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.6 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11.7 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.11 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.12 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.1 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.13 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.2 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.3 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.4 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.5 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.6 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.7 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.8 lib/spec/mocks/order_group.rb
dchelimsky-rspec-1.1.99.9 lib/spec/mocks/order_group.rb