Class Spec::Mocks::ErrorGenerator
In: lib/spec/mocks/error_generator.rb
Parent: Object

Methods

Attributes

opts  [W] 

Public Class methods

[Source]

   # File lib/spec/mocks/error_generator.rb, line 6
6:       def initialize(target, name)
7:         @target = target
8:         @name = name
9:       end

Public Instance methods

[Source]

    # File lib/spec/mocks/error_generator.rb, line 11
11:       def opts
12:         @opts ||= {}
13:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 33
33:       def raise_block_failed_error(sym, detail)
34:         __raise "#{intro} received :#{sym} but passed block failed with: #{detail}"
35:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 25
25:       def raise_expectation_error(sym, expected_received_count, actual_received_count, *args)
26:         __raise "#{intro} expected :#{sym}#{arg_message(*args)} #{count_message(expected_received_count)}, but received it #{count_message(actual_received_count)}"
27:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 37
37:       def raise_missing_block_error(args_to_yield)
38:         __raise "#{intro} asked to yield |#{arg_list(*args_to_yield)}| but no block was passed"
39:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 29
29:       def raise_out_of_order_error(sym)
30:         __raise "#{intro} received :#{sym} out of order"
31:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 19
19:       def raise_unexpected_message_args_error(expectation, *args)
20:         expected_args = format_args(*expectation.expected_args)
21:         actual_args = args.empty? ? "(no args)" : format_args(*args)
22:         __raise "#{intro} expected #{expectation.sym.inspect} with #{expected_args} but received it with #{actual_args}"
23:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 15
15:       def raise_unexpected_message_error(sym, *args)
16:         __raise "#{intro} received unexpected message :#{sym}#{arg_message(*args)}"
17:       end

[Source]

    # File lib/spec/mocks/error_generator.rb, line 41
41:       def raise_wrong_arity_error(args_to_yield, arity)
42:         __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}"
43:       end

[Validate]