Class: Transpec::Syntax::OnelinerShould::ExpectRecordBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build

Constructor Details

#initialize(should, negative_form_of_to = nil) ⇒ ExpectRecordBuilder

Returns a new instance of ExpectRecordBuilder.



138
139
140
141
# File 'lib/transpec/syntax/oneliner_should.rb', line 138

def initialize(should, negative_form_of_to = nil)
  @should = should
  @negative_form_of_to = negative_form_of_to
end

Instance Attribute Details

#negative_form_of_to ⇒ Object (readonly)

Returns the value of attribute negative_form_of_to.



136
137
138
# File 'lib/transpec/syntax/oneliner_should.rb', line 136

def negative_form_of_to
  @negative_form_of_to
end

#should ⇒ Object (readonly)

Returns the value of attribute should.



136
137
138
# File 'lib/transpec/syntax/oneliner_should.rb', line 136

def should
  @should
end

Instance Method Details

#new_syntax ⇒ Object



149
150
151
152
153
# File 'lib/transpec/syntax/oneliner_should.rb', line 149

def new_syntax
  syntax = 'it { is_expected.'
  syntax << (should.positive? ? 'to' : negative_form_of_to)
  syntax << ' ... }'
end

#old_syntax ⇒ Object



143
144
145
146
147
# File 'lib/transpec/syntax/oneliner_should.rb', line 143

def old_syntax
  syntax = 'it { should'
  syntax << '_not' unless should.positive?
  syntax << ' ... }'
end