Sha256: bac0b8ecbeb45397ab4c9522e13d2c58b4c8aec04b1c7cd09e4df6e7edfffd18

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

module Deface
  module Actions
    describe InsertBottom do
      include_context "mock Rails.application"
      before { Dummy.all.clear }

      describe "with a single insert_bottom override defined" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_bottom => "ul", :text => "<li>I'm always last</li>") }
        let(:source) { "<ul><li>first</li><li>second</li><li>third</li></ul>" }

        it "should return modified source" do
          Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>first</li><li>second</li><li>third</li><li>I'm always last</li></ul>"
        end
      end

      describe "with a single insert_bottom override defined when targetted elemenet has no children" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_bottom => "ul", :text => "<li>I'm always last</li>") }
        let(:source) { "<ul></ul>" }

        it "should return modified source" do
          Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "").should == "<ul><li>I'm always last</li></ul>"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/deface-1.0.1/spec/deface/actions/insert_bottom_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/deface-1.0.1/spec/deface/actions/insert_bottom_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/deface-1.0.1/spec/deface/actions/insert_bottom_spec.rb
deface-1.0.1 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.0.rc4 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.0.rc3 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.0.rc2 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.0.rc1 spec/deface/actions/insert_bottom_spec.rb