Sha256: 8df5952d263f117c42d2193689d1f2c2db60d0268ba3c5a6bcdd56eb8901cc5c

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

require 'cucumber/html_formatter/template_writer'

describe Cucumber::HTMLFormatter::TemplateWriter do
  context 'write_between' do
    let(:subject) { writer = Cucumber::HTMLFormatter::TemplateWriter.new(template) }
    let(:template) { 'Some template {{here}} with content after' }

    it 'outputs content of the template between the given words' do
      expect(subject.write_between('Some', 'content')).to eq(' template {{here}} with ')
    end

    context 'when "from" argument is nil' do
      it 'outputs template from the beginning' do
        expect(subject.write_between(nil, '{{here}}')).to eq('Some template ')
      end
    end

    context 'when "to" argument is nil' do
      it 'outputs content of template after the "from" argument value' do
        expect(subject.write_between('{{here}}', nil)).to eq(' with content after')
      end
    end

    context 'when "from" argument is missing from the template' do
      it 'renders the template from the beginning' do
        expect(subject.write_between('Unknown start', '{{here}}')).to eq('Some template ')
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cucumber-html-formatter-13.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-12.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-11.0.2 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-11.0.1 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-11.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-9.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-8.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-7.2.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-7.1.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-7.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-6.0.3 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-6.0.2 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-6.0.1 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-5.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-4.3.0 spec/html-formatter/template_writer_spec.rb