Class: Surrogate::RSpec::Handler

Inherits:
Struct
  • Object
show all
Defined in:
lib/surrogate/rspec/api_method_matchers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#instanceObject

Returns the value of attribute instance.



71
72
73
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 71

def instance
  @instance
end

#language_typeObject

Returns the value of attribute language_type

Returns:

  • (Object)

    the current value of language_type



70
71
72
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 70

def language_type
  @language_type
end

#message_typeObject

Returns the value of attribute message_type.



71
72
73
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 71

def message_type
  @message_type
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



70
71
72
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 70

def subject
  @subject
end

Instance Method Details

#failure_message_for_shouldObject



101
102
103
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 101

def failure_message_for_should
  message_for :should, message_type
end

#failure_message_for_should_notObject



105
106
107
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 105

def failure_message_for_should_not
  message_for :should_not, message_type
end

#inspect_arguments(args) ⇒ Object



77
78
79
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 77

def inspect_arguments(args)
  MessagesFor.inspect_arguments args
end

#invocationsObject



85
86
87
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 85

def invocations
  instance.invocations(subject)
end

#match?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 93

def match?
  times_invoked > 0
end

#message_for(message_category, message_type) ⇒ Object



73
74
75
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 73

def message_for(message_category, message_type)
  MessagesFor.message_for(language_type, message_category, message_type, binding)
end

#times_invokedObject



89
90
91
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 89

def times_invoked
  invocations.size
end

#times_msg(n) ⇒ Object



97
98
99
# File 'lib/surrogate/rspec/api_method_matchers.rb', line 97

def times_msg(n)
  "#{n} time#{'s' unless n == 1}"
end