Class: RSpec::Matchers::DelegateMatcher::Expected

Inherits:
Object
  • Object
show all
Includes:
Block
Defined in:
lib/delegate_matcher/expected.rb

Instance Attribute Summary collapse

Attributes included from Block

#block

Instance Method Summary collapse

Methods included from Block

#block_source

Constructor Details

#initializeExpected

Returns a new instance of Expected.



10
11
12
13
# File 'lib/delegate_matcher/expected.rb', line 10

def initialize
  self.check_return = true
  # @args = [Mocks::ArgumentMatchers::NoArgsMatcher::INSTANCE]
end

Instance Attribute Details

#allow_nilObject

Returns the value of attribute allow_nil.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def allow_nil
  @allow_nil
end

#argsObject

Returns the value of attribute args.



8
9
10
# File 'lib/delegate_matcher/expected.rb', line 8

def args
  @args
end

#asObject

Returns the value of attribute as.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def as
  @as
end

#check_returnObject

Returns the value of attribute check_return.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def check_return
  @check_return
end

#method_nameObject

Returns the value of attribute method_name.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def method_name
  @method_name
end

#return_valueObject

Returns the value of attribute return_value.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def return_value
  @return_value
end

#subjectObject

Returns the value of attribute subject.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def subject
  @subject
end

#toObject

Returns the value of attribute to.



7
8
9
# File 'lib/delegate_matcher/expected.rb', line 7

def to
  @to
end

Instance Method Details

#as_argsObject



38
39
40
# File 'lib/delegate_matcher/expected.rb', line 38

def as_args
  @as_args || args
end

#delegator_method_nameObject



46
47
48
# File 'lib/delegate_matcher/expected.rb', line 46

def delegator_method_name
  "#{prefix}#{method_name}"
end

#descriptionObject



50
51
52
# File 'lib/delegate_matcher/expected.rb', line 50

def description
  "delegate #{delegator_description} to #{delegate_description}#{options_description}"
end

#prefixObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/delegate_matcher/expected.rb', line 20

def prefix
  case
  when !@has_prefix
    ''
  when @prefix
    "#{@prefix}_"
  when to[0].is_a?(String) || to[0].is_a?(Symbol)
    to[0].to_s.delete('@').downcase + '_'
  else
    ''
  end
end

#prefix=(prefix) ⇒ Object



15
16
17
18
# File 'lib/delegate_matcher/expected.rb', line 15

def prefix=(prefix)
  @has_prefix = true
  @prefix     = prefix
end

#to_descriptionObject



54
55
56
# File 'lib/delegate_matcher/expected.rb', line 54

def to_description
  to.join(',')
end