class RSpec::Varys::DSL::Confirmation
Public Class Methods
new(object)
click to toggle source
# File lib/rspec/varys.rb, line 15 def initialize(object) @object = object end
Public Instance Methods
can(ability)
click to toggle source
# File lib/rspec/varys.rb, line 19 def can(ability) @ability = ability RSpec::Varys.confirmed_messages << to_expectation end
Private Instance Methods
args()
click to toggle source
# File lib/rspec/varys.rb, line 35 def args customization = customizations.find{|c| c.instance_variable_get('@method_name') == :with} (customization && customization.instance_variable_get('@args')) || [] end
class_name()
click to toggle source
# File lib/rspec/varys.rb, line 49 def class_name @object.class.name end
customizations()
click to toggle source
# File lib/rspec/varys.rb, line 45 def customizations @ability.instance_variable_get('@recorded_customizations') end
message()
click to toggle source
# File lib/rspec/varys.rb, line 53 def message @ability.instance_variable_get('@message') end
return_value()
click to toggle source
# File lib/rspec/varys.rb, line 40 def return_value customization = customizations.find{|c| c.instance_variable_get('@method_name') == :and_return} customization && customization.instance_variable_get('@args').first end
to_expectation()
click to toggle source
# File lib/rspec/varys.rb, line 26 def to_expectation { class_name: class_name, message: message, args: args, return_value: return_value } end