Sha256: af808cdeda9a877263bfd218abff19f45fc1f45da6a2e4ba95cfdbd085ade782

Contents?: true

Size: 1.08 KB

Versions: 26

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

26 entries across 26 versions & 4 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-html-formatter-20.4.0/spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-21.0.0 spec/html-formatter/template_writer_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-html-formatter-20.4.0/spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.4.0 spec/html-formatter/template_writer_spec.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.3.1 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.3.0 spec/html-formatter/template_writer_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/spec/html-formatter/template_writer_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/spec/html-formatter/template_writer_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.2.1 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.2.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.1.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-20.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-19.2.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-19.1.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-19.0.0 spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-18.0.0 spec/html-formatter/template_writer_spec.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-html-formatter-17.0.0/spec/html-formatter/template_writer_spec.rb
cucumber-html-formatter-17.0.0 spec/html-formatter/template_writer_spec.rb