Class: Spec::Expectations::Helper::CollectionOwner

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/plugins/rspec/spec/support/spec_classes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCollectionOwner

Returns a new instance of CollectionOwner.



36
37
38
39
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 36

def initialize
  @items_in_collection_with_size_method = CollectionWithSizeMethod.new
  @items_in_collection_with_length_method = CollectionWithLengthMethod.new
end

Instance Attribute Details

#items_in_collection_with_length_methodObject (readonly)

Returns the value of attribute items_in_collection_with_length_method.



34
35
36
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 34

def items_in_collection_with_length_method
  @items_in_collection_with_length_method
end

#items_in_collection_with_size_methodObject (readonly)

Returns the value of attribute items_in_collection_with_size_method.



34
35
36
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 34

def items_in_collection_with_size_method
  @items_in_collection_with_size_method
end

Instance Method Details

#add_to_collection_with_length_method(item) ⇒ Object



45
46
47
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 45

def add_to_collection_with_length_method(item)
  @items_in_collection_with_length_method.push(item)
end

#add_to_collection_with_size_method(item) ⇒ Object



41
42
43
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 41

def add_to_collection_with_size_method(item)
  @items_in_collection_with_size_method.push(item)
end

#itemsObject



54
55
56
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 54

def items
  @items_in_collection_with_size_method
end

#items_for(arg) ⇒ Object



49
50
51
52
# File 'lib/vendor/plugins/rspec/spec/support/spec_classes.rb', line 49

def items_for(arg)
  return [1, 2, 3] if arg == 'a'
  [1]
end