Sha256: dff36fef07cb735301fd1d82fd7a9d033044b0d839e55030891071956c1dde0f

Contents?: true

Size: 1.58 KB

Versions: 245

Compression:

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

245 entries across 144 versions & 26 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/spec/support/classes.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.0/spec/support/classes.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.10.0/spec/support/classes.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.1/spec/support/classes.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.10.0/spec/support/classes.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.0/spec/support/classes.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.1/spec/support/classes.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.10.0/spec/support/classes.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.0/spec/support/classes.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.1/spec/support/classes.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/spec/support/classes.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-expectations-2.13.0/spec/support/classes.rb
rspec-expectations-2.99.2 spec/support/classes.rb