Sha256: 78207af98fbcabf32a5a5829666b1e0536a0bc71070d6ae66ef6537fe145be92

Contents?: true

Size: 997 Bytes

Versions: 3

Compression:

Stored size: 997 Bytes

Contents

require "spec_helper"

module BitCore
  describe Slide do
    fixtures :"bit_core/slideshows", :"bit_core/slides"

    describe "#render_body" do
      it "should render a nil body" do
        expect(subject.render_body).to eq("")
      end

      it "should render markdown as html" do
        subject.body = "# header"

        expect(subject.render_body).to match(/<h1>header<\/h1>/)
      end

      it "should escape html" do
        subject.body = "<div>my content</div>"

        expect(subject.render_body).to match(/<p>my content<\/p>/)
      end
    end

    describe "when destroyed" do
      let(:slideshow) { bit_core_slideshows(:slideshow1) }
      let(:slide) { bit_core_slides(:slide2) }

      it "updates the positions of remaining slides" do
        expect(slideshow.slides.map(&:position)).to eq [1, 2, 3]
        expect(slide.position).to eq 2

        slide.destroy

        expect(slideshow.reload.slides.map(&:position))
          .to eq [1, 2]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_core-2.0.0.beta1 spec/models/bit_core/slide_spec.rb
bit_core-1.4.6 spec/models/bit_core/slide_spec.rb
bit_core-1.4.5 spec/models/bit_core/slide_spec.rb