Sha256: 252796f5339ae8ab835b8187060762d476864e4df6d38079149ff11930dcc16c

Contents?: true

Size: 726 Bytes

Versions: 3

Compression:

Stored size: 726 Bytes

Contents

require 'spec_helper'

describe JekyllGithubSample::TextUtils do

  let(:text_utils) { class Tester; include JekyllGithubSample::TextUtils; end.new }

  context '#remove_common_indentation' do
    let(:lines) {[
     '   def method',
     '     a = 1',
     '   end'
    ]}
    subject { text_utils.remove_common_indentation(lines) }

    it 'removes 3 spaces of common indentation' do
      should =~ [
        'def method',
        '  a = 1',
        'end'
      ]
    end

    context 'for lines with no common indentation' do
      let(:lines) { [
          'def new_method',
          '  raise',
          'end'
      ] }

      it 'does nothing to the indentation' do
        should =~ lines
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll_github_sample-0.2.0 spec/lib/jekyll_github_sample/text_utils_spec.rb
jekyll_github_sample-0.1.1 spec/lib/jekyll_github_sample/text_utils_spec.rb
jekyll_github_sample-0.1.0 spec/lib/jekyll_github_sample/text_utils_spec.rb