Class: Transpec::Syntax::Its::RecordBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build

Constructor Details

#initialize(its) ⇒ RecordBuilder

Returns a new instance of RecordBuilder.



187
188
189
# File 'lib/transpec/syntax/its.rb', line 187

def initialize(its)
  @its = its
end

Instance Attribute Details

#its ⇒ Object (readonly)

Returns the value of attribute its.



185
186
187
# File 'lib/transpec/syntax/its.rb', line 185

def its
  @its
end

Instance Method Details

#new_syntax ⇒ Object



199
200
201
202
203
204
205
# File 'lib/transpec/syntax/its.rb', line 199

def new_syntax
  if its.attribute_expression.brackets?
    "describe '[:key]' do subject { super()[:key] }; it { } end"
  else
    "describe '#attr' do subject { super().attr }; it { } end"
  end
end

#old_syntax ⇒ Object



191
192
193
194
195
196
197
# File 'lib/transpec/syntax/its.rb', line 191

def old_syntax
  if its.attribute_expression.brackets?
    'its([:key]) { }'
  else
    'its(:attr) { }'
  end
end