Class: Bogus::Interaction

Inherits:
Struct
  • Object
show all
Defined in:
lib/bogus/stubbing/interaction.rb

Defined Under Namespace

Classes: ArgumentComparator, InteractionComparator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, args, &block) ⇒ Interaction

Returns a new instance of Interaction.



9
10
11
12
13
14
15
16
17
# File 'lib/bogus/stubbing/interaction.rb', line 9

def initialize(method, args, &block)
  self.method = method
  self.args = args

  if block_given?
    evaluate_return_value(block)
    self.has_result = true
  end
end

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



2
3
4
# File 'lib/bogus/stubbing/interaction.rb', line 2

def args
  @args
end

#argumentsObject

Returns the value of attribute arguments.



3
4
5
# File 'lib/bogus/stubbing/interaction.rb', line 3

def arguments
  @arguments
end

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



2
3
4
# File 'lib/bogus/stubbing/interaction.rb', line 2

def error
  @error
end

#has_resultObject

Returns the value of attribute has_result

Returns:

  • (Object)

    the current value of has_result



2
3
4
# File 'lib/bogus/stubbing/interaction.rb', line 2

def has_result
  @has_result
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



2
3
4
# File 'lib/bogus/stubbing/interaction.rb', line 2

def method
  @method
end

#return_valueObject

Returns the value of attribute return_value

Returns:

  • (Object)

    the current value of return_value



2
3
4
# File 'lib/bogus/stubbing/interaction.rb', line 2

def return_value
  @return_value
end

Class Method Details

.same?(opts = {}) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/bogus/stubbing/interaction.rb', line 5

def self.same?(opts = {})
  InteractionComparator.new(opts).same?
end