@private
# File lib/rspec/mocks/error_generator.rb, line 7 def initialize(target, name, options={}) @declared_as = options[:__declared_as] || 'Mock' @target = target @name = name end
@private
# File lib/rspec/mocks/error_generator.rb, line 14 def opts @opts ||= {} end
@private
# File lib/rspec/mocks/error_generator.rb, line 48 def raise_block_failed_error(sym, detail) __raise "#{intro} received :#{sym} but passed block failed with: #{detail}" end
@private
# File lib/rspec/mocks/error_generator.rb, line 38 def raise_expectation_error(sym, expected_received_count, actual_received_count, *args) __raise "(#{intro}).#{sym}#{format_args(*args)}\n expected: #{count_message(expected_received_count)}\n received: #{count_message(actual_received_count)}" end
@private
# File lib/rspec/mocks/error_generator.rb, line 53 def raise_missing_block_error(args_to_yield) __raise "#{intro} asked to yield |#{arg_list(*args_to_yield)}| but no block was passed" end
@private
# File lib/rspec/mocks/error_generator.rb, line 43 def raise_out_of_order_error(sym) __raise "#{intro} received :#{sym} out of order" end
@private
# File lib/rspec/mocks/error_generator.rb, line 31 def raise_similar_message_args_error(expectation, *args) expected_args = format_args(*expectation.expected_args) actual_args = args.collect {|a| format_args(*a)}.join(", ") __raise "#{intro} received #{expectation.sym.inspect} with unexpected arguments\n expected: #{expected_args}\n got: #{actual_args}" end
@private
# File lib/rspec/mocks/error_generator.rb, line 24 def raise_unexpected_message_args_error(expectation, *args) expected_args = format_args(*expectation.expected_args) actual_args = format_args(*args) __raise "#{intro} received #{expectation.sym.inspect} with unexpected arguments\n expected: #{expected_args}\n got: #{actual_args}" end
@private
# File lib/rspec/mocks/error_generator.rb, line 19 def raise_unexpected_message_error(sym, *args) __raise "#{intro} received unexpected message :#{sym}#{arg_message(*args)}" end
@private
# File lib/rspec/mocks/error_generator.rb, line 58 def raise_wrong_arity_error(args_to_yield, arity) __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}" end