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 34
34:       def raise_block_failed_error(sym, detail)
35:         __raise "#{intro} received :#{sym} but passed block failed with: #{detail}"
36:       end

[Source]

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

[Source]

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

[Source]

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

[Source]

    # File lib/spec/mocks/error_generator.rb, line 19
19:       def raise_unexpected_message_args_error(expectation, *args)
20:         #this is either :no_args or an Array
21:         expected_args = (expectation.expected_args == :no_args ? "(no args)" : format_args(*expectation.expected_args))
22:         actual_args = args.empty? ? "(no args)" : format_args(*args)
23:         __raise "#{intro} expected #{expectation.sym.inspect} with #{expected_args} but received it with #{actual_args}"
24:       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 42
42:       def raise_wrong_arity_error(args_to_yield, arity)
43:         __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}"
44:       end

[Validate]