zackads / mumble

https://learn.madetech.com/katas/mumbling/
0 stars 0 forks source link

Feature/two lowercase letters #4

Open zackads opened 4 years ago

zackads commented 4 years ago

Propose to complete feature two_lowercase_letters and merge. 🥳

The following tests now pass:

      { input: 'ab', expected_output: 'A-Bb' },
      { input: 'bc', expected_output: 'B-Cc' },
      { input: 'cd', expected_output: 'C-Dd' },

I've also refactored the tests in to an array of expectations:

describe Mumble do
  describe '.mumble_letters' do
    expectations = [
      { input: '', expected_output: '' },
      { input: 'A', expected_output: 'A' },
      { input: 'B', expected_output: 'B' },
      { input: 'AB', expected_output: 'A-Bb' },
      { input: 'BC', expected_output: 'B-Cc' },
      { input: 'CD', expected_output: 'C-Dd' },
      { input: 'ab', expected_output: 'A-Bb' },
      { input: 'bc', expected_output: 'B-Cc' },
      { input: 'cd', expected_output: 'C-Dd' },
      { input: 'ABC', expected_output: 'A-Bb-Ccc' }
    ]

    expectations.each do |test_case|
      context "given #{test_case[:input]}," do
        it "expect #{test_case[:expected_output]}" do
          # Arrange
          mumbler = Mumble.new

          # Act
          output = mumbler.mumble_letters(test_case[:input])

          # Assert
          expect(output).to eq test_case[:expected_output]
        end
      end
    end
  end
end