Sha256: 301574f45d02343a655fbb3453ae5e28b6ae113bca08a158a97bf4aa3f6929fb

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

# This file contains 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

12 entries across 12 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 spec/support/classes.rb
rspec-expectations-2.0.0.beta.7 spec/support/classes.rb
rspec-expectations-2.0.0.beta.6 spec/support/classes.rb
rspec-expectations-2.0.0.beta.5 spec/support/classes.rb
rspec-expectations-2.0.0.beta.4 spec/support/classes.rb
rspec-expectations-2.0.0.beta.3 spec/support/classes.rb
rspec-expectations-2.0.0.beta.2 spec/support/classes.rb
rspec-expectations-2.0.0.beta.1 spec/support/classes.rb
rspec-expectations-2.0.0.a10 spec/support/classes.rb
rspec-expectations-2.0.0.a9 spec/support/classes.rb
rspec-expectations-2.0.0.a8 spec/support/classes.rb
rspec-expectations-2.0.0.a7 spec/support/classes.rb