Sha256: d816a773c0416db51a32bd31ce31abb0c82cedbaff87c66defcaef467a329f86

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

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

      describe "with a single insert_top override defined" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_top => "ul", :text => "<li>me first</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>me first</li><li>first</li><li>second</li><li>third</li></ul>"
        end
      end

      describe "with a single insert_top override defined when targetted elemenet has no children" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_top => "ul", :text => "<li>first</li><li>second</li><li>third</li>") }
        let(:source) { "<ul></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></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_top_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/deface-1.0.1/spec/deface/actions/insert_top_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/deface-1.0.1/spec/deface/actions/insert_top_spec.rb
deface-1.0.1 spec/deface/actions/insert_top_spec.rb
deface-1.0.0 spec/deface/actions/insert_top_spec.rb
deface-1.0.0.rc4 spec/deface/actions/insert_top_spec.rb
deface-1.0.0.rc3 spec/deface/actions/insert_top_spec.rb
deface-1.0.0.rc2 spec/deface/actions/insert_top_spec.rb
deface-1.0.0.rc1 spec/deface/actions/insert_top_spec.rb