Sha256: bb37a7bddb2f65d7d10db83e249290d8fb197b48a4e9701bdebff157e7c5048d

Contents?: true

Size: 1.59 KB

Versions: 15

Compression:

Stored size: 1.59 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 CollectionWithCountMethod
        def initialize; @list = []; end
        def count; @list.count; 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, :items_in_collection_with_count_method

        def initialize
          @items_in_collection_with_size_method = CollectionWithSizeMethod.new
          @items_in_collection_with_length_method = CollectionWithLengthMethod.new
          @items_in_collection_with_count_method = CollectionWithCountMethod.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 add_to_collection_with_count_method(item)
          @items_in_collection_with_count_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

15 entries across 15 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rspec-collection_matchers-1.2.1/spec/support/classes.rb
rspec-collection_matchers-1.2.1 spec/support/classes.rb
rspec-collection_matchers-1.2.0 spec/support/classes.rb
rspec-collection_matchers-1.1.3 spec/support/classes.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/rspec-collection_matchers-1.1.2/spec/support/classes.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/rspec-collection_matchers-1.1.2/spec/support/classes.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rspec-collection_matchers-1.1.2/spec/support/classes.rb
rspec-collection_matchers-1.1.2 spec/support/classes.rb
rspec-collection_matchers-1.1.1 spec/support/classes.rb
rspec-collection_matchers-1.1.0 spec/support/classes.rb
rspec-collection_matchers-1.0.0 spec/support/classes.rb
rspec-collection_matchers-0.0.4 spec/support/classes.rb
rspec-collection_matchers-0.0.3 spec/support/classes.rb
rspec-collection_matchers-0.0.2 spec/support/classes.rb
rspec-collection_matchers-0.0.1 spec/support/classes.rb