class Transpec::Syntax::OnelinerShould::HaveRecordBuilder
Public Instance Methods
had_description?()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 189 def had_description? return false unless should.example should.example.description? end
has_description?()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 194 def has_description? # rubocop:disable PredicateName !should.example.nil? end
new_description()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 164 def new_description if has_description? if had_description? "it '...' do" else "it '#{should.build_description('n')}' do" end else 'it {' end end
new_expectation()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 176 def new_expectation case should.current_syntax_type when :should "#{new_subject}.#{should.method_name}" when :expect "expect(#{new_subject})." + (should.positive? ? 'to' : negative_form_of_to) end end
new_subject()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 185 def new_subject build_new_subject('subject') end
new_syntax()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 154 def new_syntax syntax = new_description syntax << ' ' syntax << new_expectation syntax << ' ' syntax << source_builder.replacement_matcher_source syntax << ' ' syntax << (has_description? ? 'end' : '}') end
old_syntax()
click to toggle source
# File lib/transpec/syntax/oneliner_should.rb, line 148 def old_syntax syntax = had_description? ? "it '...' do" : 'it {' syntax << " #{should.method_name} #{have.method_name}(n).#{old_items} " syntax << (had_description? ? 'end' : '}') end