Sha256: bfb8f373f51011e4ae1a98b2c6f2918597951c1cda9426d7d85e3d33fe7ced32

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

# various classes used by the specs
module RSpec
  module Expectations
    module Helper
      class CollectionWithSizeMethod
        def initialize; @list = []; end
        def size; @list.size; end
        def push(item); @list.push(item); end
      end
      
      class CollectionWithLengthMethod
        def initialize; @list = []; end
        def length; @list.size; end
        def push(item); @list.push(item); end
      end

      class CollectionOwner
        attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method
      
        def initialize
          @items_in_collection_with_size_method = CollectionWithSizeMethod.new
          @items_in_collection_with_length_method = CollectionWithLengthMethod.new
        end
      
        def add_to_collection_with_size_method(item)
          @items_in_collection_with_size_method.push(item)
        end
      
        def add_to_collection_with_length_method(item)
          @items_in_collection_with_length_method.push(item)
        end
      
        def items_for(arg)
          return [1, 2, 3] if arg == 'a'
          [1]
        end
      
        def items
          @items_in_collection_with_size_method
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/spec/support/classes.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/spec/support/classes.rb
rspec-expectations-2.6.0 spec/support/classes.rb
rspec-expectations-2.6.0.rc6 spec/support/classes.rb
rspec-expectations-2.6.0.rc4 spec/support/classes.rb
rspec-expectations-2.6.0.rc2 spec/support/classes.rb
rspec-expectations-2.5.0 spec/support/classes.rb
rspec-expectations-2.4.0 spec/support/classes.rb
rspec-expectations-2.3.0 spec/support/classes.rb