Class: CodeDrivenDevelopment::Stubber::AbstractStubber

Inherits:
Object
  • Object
show all
Defined in:
lib/code_driven_development/stubber/abstract_stubber.rb

Instance Method Summary collapse

Constructor Details

#initialize(sexp) ⇒ AbstractStubber

Returns a new instance of AbstractStubber.



4
5
6
# File 'lib/code_driven_development/stubber/abstract_stubber.rb', line 4

def initialize(sexp)
  @sexp = sexp
end

Instance Method Details

#beforesObject



12
13
14
15
16
# File 'lib/code_driven_development/stubber/abstract_stubber.rb', line 12

def befores
  [
    "allow(#{receiver_value}).to receive(:#{method_name}).and_return(#{method_name})"
  ]
end

#bodyObject



24
25
26
27
28
# File 'lib/code_driven_development/stubber/abstract_stubber.rb', line 24

def body
  [
    "expect(#{receiver_value}).to have_received :#{method_name}"
  ]
end

#doublesObject



18
19
20
21
22
# File 'lib/code_driven_development/stubber/abstract_stubber.rb', line 18

def doubles
  [
    method_name.to_sym
  ]
end

#method_nameObject



8
9
10
# File 'lib/code_driven_development/stubber/abstract_stubber.rb', line 8

def method_name
  sexp[2]
end