Class: Transpec::Syntax::Should::RecordBuilder

Inherits:
RecordBuilder show all
Defined in:
lib/transpec/syntax/should.rb

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build, param_names

Instance Method Details

#new_syntaxObject



78
79
80
81
82
83
84
85
86
# File 'lib/transpec/syntax/should.rb', line 78

def new_syntax
  syntax = if should.proc_subject?
             'expect { }.'
           else
             'expect(obj).'
           end

  syntax << (should.positive? ? 'to' : negative_form_of_to)
end

#old_syntaxObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/transpec/syntax/should.rb', line 67

def old_syntax
  syntax = if should.proc_subject?
             "#{should.name_of_subject_method_taking_block} { }.should"
           else
             'obj.should'
           end

  syntax << '_not' unless should.positive?
  syntax
end