Class: Transpec::Syntax::RaiseError::RecordBuilder

Inherits:
RecordBuilder
  • Object
show all
Defined in:
lib/transpec/syntax/raise_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build

Constructor Details

#initialize(raise_error) ⇒ RecordBuilder

Returns a new instance of RecordBuilder.



42
43
44
# File 'lib/transpec/syntax/raise_error.rb', line 42

def initialize(raise_error)
  @raise_error = raise_error
end

Instance Attribute Details

#raise_error ⇒ Object (readonly)

Returns the value of attribute raise_error.



40
41
42
# File 'lib/transpec/syntax/raise_error.rb', line 40

def raise_error
  @raise_error
end

Instance Method Details

#new_syntax ⇒ Object



59
60
61
# File 'lib/transpec/syntax/raise_error.rb', line 59

def new_syntax
  'expect { }.not_to raise_error'
end

#old_syntax ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/transpec/syntax/raise_error.rb', line 46

def old_syntax
  syntax = 'expect { }.not_to raise_error('

  if raise_error.specific_class?
    syntax << 'SpecificErrorClass'
    syntax << ', ' if raise_error.specific_message?
  end

  syntax << 'message' if raise_error.specific_message?

  syntax << ')'
end