Object
@private
@private
# File lib/rspec/mocks/error_generator.rb, line 14 14: def opts 15: @opts ||= {} 16: end
@private
# File lib/rspec/mocks/error_generator.rb, line 48 48: def raise_block_failed_error(message, detail) 49: __raise "#{intro} received :#{message} but passed block failed with: #{detail}" 50: end
@private
# File lib/rspec/mocks/error_generator.rb, line 38 38: def raise_expectation_error(message, expected_received_count, actual_received_count, *args) 39: __raise "(#{intro}).#{message}#{format_args(*args)}\n expected: #{count_message(expected_received_count)}\n received: #{count_message(actual_received_count)}" 40: end
@private
# File lib/rspec/mocks/error_generator.rb, line 53 53: def raise_missing_block_error(args_to_yield) 54: __raise "#{intro} asked to yield |#{arg_list(*args_to_yield)}| but no block was passed" 55: end
@private
# File lib/rspec/mocks/error_generator.rb, line 43 43: def raise_out_of_order_error(message) 44: __raise "#{intro} received :#{message} out of order" 45: end
@private
# File lib/rspec/mocks/error_generator.rb, line 31 31: def raise_similar_message_args_error(expectation, *args) 32: expected_args = format_args(*expectation.expected_args) 33: actual_args = args.collect {|a| format_args(*a)}.join(", ") 34: __raise "#{intro} received #{expectation.message.inspect} with unexpected arguments\n expected: #{expected_args}\n got: #{actual_args}" 35: end
@private
# File lib/rspec/mocks/error_generator.rb, line 24 24: def raise_unexpected_message_args_error(expectation, *args) 25: expected_args = format_args(*expectation.expected_args) 26: actual_args = format_args(*args) 27: __raise "#{intro} received #{expectation.message.inspect} with unexpected arguments\n expected: #{expected_args}\n got: #{actual_args}" 28: end
# File lib/rspec/mocks/error_generator.rb, line 78 78: def __raise(message) 79: message = opts[:message] unless opts[:message].nil? 80: Kernel::raise(RSpec::Mocks::MockExpectationError, message) 81: end
# File lib/rspec/mocks/error_generator.rb, line 91 91: def arg_list(*args) 92: args.collect {|arg| arg.respond_to?(:description) ? arg.description : arg.inspect}.join(", ") 93: end
# File lib/rspec/mocks/error_generator.rb, line 83 83: def arg_message(*args) 84: " with " + format_args(*args) 85: end
# File lib/rspec/mocks/error_generator.rb, line 95 95: def count_message(count) 96: return "at least #{pretty_print(count.abs)}" if count < 0 97: return pretty_print(count) 98: end
# File lib/rspec/mocks/error_generator.rb, line 87 87: def format_args(*args) 88: args.empty? ? "(no args)" : "(" + arg_list(*args) + ")" 89: end
# File lib/rspec/mocks/error_generator.rb, line 64 64: def intro 65: if @name 66: "#{@declared_as} #{@name.inspect}" 67: elsif TestDouble === @target 68: @declared_as 69: elsif Class === @target 70: "<#{@target.inspect} (class)>" 71: elsif @target 72: @target 73: else 74: "nil" 75: end 76: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.