Sha256: 3e4ac70026a91aa9162c394ca761f2f638ac0296d1a8556a0beea246876ddee0

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

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

      describe "with a single replace_contents override defined" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace_contents => "p", :text => "<h1>Argh!</h1>") }
        let(:source) { "<p><span>Hello</span>I am not a <em>pirate</em></p>" }

        it "should return modified source" do
          Dummy.apply(source, {:virtual_path => "posts/index"}).should == "<p><h1>Argh!</h1></p>"
        end
      end

      describe "with a single replace_contents override with closing_selector defined" do
        before { Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace_contents => "h1", :closing_selector => "h2", :text => "<span>Argh!</span>") }
        let(:source) { "<h1>start</h1><p>some junk</p><div>more junk</div><h2>end</h2>" }

        it "should return modified source" do
          Dummy.apply(source, {:virtual_path => "posts/index"}).should == "<h1>start</h1><span>Argh!</span><h2>end</h2>"
        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/replace_contents_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/deface-1.0.1/spec/deface/actions/replace_contents_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/deface-1.0.1/spec/deface/actions/replace_contents_spec.rb
deface-1.0.1 spec/deface/actions/replace_contents_spec.rb
deface-1.0.0 spec/deface/actions/replace_contents_spec.rb
deface-1.0.0.rc4 spec/deface/actions/replace_contents_spec.rb
deface-1.0.0.rc3 spec/deface/actions/replace_contents_spec.rb
deface-1.0.0.rc2 spec/deface/actions/replace_contents_spec.rb
deface-1.0.0.rc1 spec/deface/actions/replace_contents_spec.rb