Sha256: 2d9032de6b96ec2b6e3c40394270c03a8db3eb2f41b8359d259bf9c786d28221

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 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
          expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<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
          expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>I'm always last</li></ul>")
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
deface-1.9.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.8.2 spec/deface/actions/insert_bottom_spec.rb
deface-1.8.1 spec/deface/actions/insert_bottom_spec.rb
deface-1.8.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.7.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.6.2 spec/deface/actions/insert_bottom_spec.rb
deface-1.6.1 spec/deface/actions/insert_bottom_spec.rb
deface-1.6.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.5.3 spec/deface/actions/insert_bottom_spec.rb
deface-1.5.2 spec/deface/actions/insert_bottom_spec.rb
deface-1.5.1 spec/deface/actions/insert_bottom_spec.rb
deface-1.5.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.4.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.3.2 spec/deface/actions/insert_bottom_spec.rb
deface-1.3.1 spec/deface/actions/insert_bottom_spec.rb
deface-1.3.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.2.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.1.0 spec/deface/actions/insert_bottom_spec.rb
deface-1.0.2 spec/deface/actions/insert_bottom_spec.rb