Sha256: dc79beee7d19867f14f8b3938d4b441b26ea382e5ead5df5ae005b5d9ead91ad
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 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 expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<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 expect(Dummy.apply(source, {:virtual_path => "posts/index"}).gsub("\n", "")).to eq("<ul><li>first</li><li>second</li><li>third</li></ul>") end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems