Sha256: e147d20f8c06a63699061b93ae449b101ac35a2428bd3ddfecd48a10b73fe8df

Contents?: true

Size: 1.34 KB

Versions: 39

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe Caracal::Core::Text do
  subject { Caracal::Document.new }
  
  
  #-------------------------------------------------------------
  # Public Methods
  #-------------------------------------------------------------

  describe 'public method tests' do
    
    # all commands
    [:p, :h1, :h2, :h3, :h4, :h5, :h6].each do |cmd|
      describe ".#{ cmd }" do
        let!(:size) { subject.contents.size }
      
        before { subject.send(cmd, 'Smaple text.') }
      
        it { expect(subject.contents.size).to eq size + 1 }
        it { expect(subject.contents.last).to be_a(Caracal::Core::Models::ParagraphModel) }
      end
    end
    
  end
  
  
  #-------------------------------------------------------------
  # Private Methods
  #-------------------------------------------------------------

  describe 'private method tests' do
    
    # .style_id_for_header
    describe '.style_id_for_header' do
      (1..6).each do |i|
        describe "when h#{ i }" do
          let(:actual) { subject.send(:style_id_for_header, "h#{ i }") }
          
          it { expect(actual).to eq "Heading#{ i }" }
        end
      end
      describe 'when unknown return normal' do
        let(:actual) { subject.send(:style_id_for_header, 'Dummy') }
        
        it { expect(actual).to eq 'Normal' }
      end
    end
    
  end
  
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
caracal_the_curve-1.4.6 spec/lib/caracal/core/text_spec.rb
caracal_the_curve-1.4.5 spec/lib/caracal/core/text_spec.rb
caracal_the_curve-1.4.4 spec/lib/caracal/core/text_spec.rb
caracal_the_curve-1.4.3 spec/lib/caracal/core/text_spec.rb
caracal_the_curve-1.4.2 spec/lib/caracal/core/text_spec.rb
caracal_the_curve-1.4.1 spec/lib/caracal/core/text_spec.rb
caracal-1.4.1 spec/lib/caracal/core/text_spec.rb
caracal-1.4.0 spec/lib/caracal/core/text_spec.rb
caracal-1.3.0 spec/lib/caracal/core/text_spec.rb
caracal-1.2.0 spec/lib/caracal/core/text_spec.rb
caracal-1.1.2 spec/lib/caracal/core/text_spec.rb
caracal-1.1.1 spec/lib/caracal/core/text_spec.rb
caracal-1.1.0 spec/lib/caracal/core/text_spec.rb
caracal-1.0.13 spec/lib/caracal/core/text_spec.rb
caracal-1.0.12 spec/lib/caracal/core/text_spec.rb
caracal-1.0.11 spec/lib/caracal/core/text_spec.rb
caracal-1.0.10 spec/lib/caracal/core/text_spec.rb
caracal-1.0.9 spec/lib/caracal/core/text_spec.rb
caracal-1.0.8 spec/lib/caracal/core/text_spec.rb
caracal-1.0.7 spec/lib/caracal/core/text_spec.rb