Sha256: b0c505105ec4e9bb9f61a7b3a3e04479a36e6c4796a40a22a28be370a56fc9a7

Contents?: true

Size: 1 KB

Versions: 32

Compression:

Stored size: 1 KB

Contents

require 'rspec'
require 'gherkin/gherkin_line'

describe Gherkin::GherkinLine do
  context '#tags' do
    def tags(line)
      Gherkin::GherkinLine.new(line, 12).tags.map(&:text)
    end

    it 'allows any non-space characters in a tag' do
      expect(tags("   @foo:bar  @zap🥒yo")).to eq(['@foo:bar', '@zap🥒yo'])
    end
  end

  context '#table_cells' do
    def cells_text(line)
      Gherkin::GherkinLine.new(line, 12).table_cells.map(&:text)
    end

    it 'trims white spaces before cell content' do
      expect(cells_text("|   \t spaces before|")).to eq(['spaces before'])
    end

    it 'trims white spaces after cell content' do
      expect(cells_text("|spaces after   |")).to eq(['spaces after'])
    end

    it 'trims white spaces around cell content' do
      expect(cells_text("|   \t spaces everywhere   \t|")).to eq(['spaces everywhere'])
    end

    it 'does not drop white spaces inside a cell' do
      expect(cells_text("| foo()\n  bar\nbaz |")).to eq(["foo()\n  bar\nbaz"])
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
cucumber-gherkin-28.0.0 spec/gherkin/gherkin_line_spec.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-gherkin-26.2.0/spec/gherkin/gherkin_line_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-gherkin-26.2.0/spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-27.0.0 spec/gherkin/gherkin_line_spec.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.2.0 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.1.0 spec/gherkin/gherkin_line_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/spec/gherkin/gherkin_line_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/spec/gherkin/gherkin_line_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.0.3 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.0.2 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.0.1 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-26.0.0 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-25.0.2 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-25.0.1 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-25.0.0 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-24.1.0 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-24.0.0 spec/gherkin/gherkin_line_spec.rb
cucumber-gherkin-23.0.1 spec/gherkin/gherkin_line_spec.rb