Sha256: 44b3a99838cd80fa7fd31bc343b119e1af0e16b88753b7718f66bcbf24f1f8b6

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'pgit'

describe 'PGit::StoryBranch::NameParser' do
  describe '#name' do
    it 'should remove fluff words, remove periods,
        replace spaces with dashes, suffix story_id' do

      unparsed_name = "Deemphasize the Clue on the stimulus screen of multi-screen exercises."
      story_id = '12345'
      fake_story = double('PGit::Story', id: story_id, name: unparsed_name)

      name_parser = PGit::StoryBranch::NameParser.new(fake_story)
      parsed = name_parser.name

      expect(parsed).to eq "deemphasize-clue-stimulus-screen-multiscreen-exercises-12345"
    end

    it 'should strip non-alpha-numerics like apostrophes' do
      unparsed_name = "Some don't like putin's dictatorship"
      story_id = '29292'

      fake_story = double('PGit::Story', id: story_id, name: unparsed_name)

      name_parser = PGit::StoryBranch::NameParser.new(fake_story)
      parsed = name_parser.name

      expect(parsed).to eq "some-dont-like-putins-dictatorship-29292"
    end

    it 'should remove all non-word characters' do
      unparsed_name = "Some *@#   don't like ,putin's dictator-ship"
      story_id = '29292'

      fake_story = double('PGit::Story', id: story_id, name: unparsed_name)

      name_parser = PGit::StoryBranch::NameParser.new(fake_story)
      parsed = name_parser.name

      expect(parsed).to eq "some-dont-like-putins-dictatorship-29292"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pgit-0.0.4 spec/pgit/story_branch/name_parser_spec.rb
pgit-0.0.3 spec/pgit/story_branch/name_parser_spec.rb
pgit-0.0.2 spec/pgit/story_branch/name_parser_spec.rb