Sha256: aedf976b9b0a114191331a6332b5b472949825c2e47c5649c9fe7b7718705486

Contents?: true

Size: 741 Bytes

Versions: 9

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'

describe String do

  describe '#permalink!' do

    let(:string) { 'foo bar' }

    before { string.permalink! }

    it { expect(string).to eq 'foo-bar' }

  end

  describe '#to_bool' do

    subject { string.to_bool }

    describe 'true values' do

      %w(true t yes y 1).each do |val|
        let(:string) { val }
        it { is_expected.to eq true }
      end

    end

    describe 'false values' do

      (%w(false f no n 0) + ['']).each do |val|
        let(:string) { val }
        it { is_expected.to eq false }
      end

    end

    describe 'no truthy or falsy' do
      let(:string) { 'foo' }
      it { expect { subject }.to raise_error(%(invalid value for Boolean: "foo")) }
    end

  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
locomotivecms_common-0.4.0 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.3.1 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.3.0 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.2.0 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.1.0 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.0.5 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.0.4 spec/unit/core_ext/string_spec.rb
locomotivecms_common-0.0.3 spec/unit/core_ext/string_spec.rb
locomotivecms_steam-1.0.0.pre.alpha spec/unit/core_ext/string_spec.rb