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