Class | Spec::Expectations::Should::Have |
In: |
lib/spec/expectations/should/have.rb
|
Parent: | Object |
# File lib/spec/expectations/should/have.rb, line 5 5: def initialize(target, relativity=:exactly, expected=nil) 6: @target = target 7: init_collection_handler(target, relativity, expected) 8: init_item_handler(target) 9: end
# File lib/spec/expectations/should/have.rb, line 11 11: def init_collection_handler(target, relativity, expected) 12: @collection_handler = CollectionHandler.new(target, relativity, expected) 13: end
# File lib/spec/expectations/should/have.rb, line 15 15: def init_item_handler(target) 16: @item_handler = PositiveItemHandler.new(target) 17: end
# File lib/spec/expectations/should/have.rb, line 19 19: def method_missing(sym, *args) 20: if @collection_handler.wants_to_handle(sym) 21: @collection_handler.handle_message(sym, *args) 22: elsif @item_handler.wants_to_handle(sym) 23: @item_handler.handle_message(sym, *args) 24: else 25: raise NoMethodError.new("#{@target.inspect} does not respond to `#{sym}' or `has_#{sym}?'") 26: end 27: end