Sha256: 4febac3bdcea8600a4e620144d70505e5dd9e5bb65caae3f7dfcea4ad78da965

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

module Deface

  describe Precompiler do
    include_context "mock Rails.application"

    before do
      # start with a clean file system
      FileUtils.rm_rf('spec/dummy/app/compiled_views')
      environment = Deface::Environment.new
      overrides = Deface::Environment::Overrides.new
      overrides.stub(:all => {}) # need to do this before creating an override
      overrides.stub(:all => {"posts/precompileme".to_sym => {"precompileme".parameterize => Deface::Override.new(:virtual_path => "posts/precompileme", :name => "precompileme", :insert_bottom => 'li', :text => "Added to li!")}})
      environment.stub(:overrides => overrides)

      Rails.application.config.stub :deface => environment

      #stub view paths to be local spec/assets directory
      ActionController::Base.stub(:view_paths).and_return([File.join(File.dirname(__FILE__), '..', "assets")])

      Precompiler.precompile()
    end

    after do
      # cleanup the file system
      FileUtils.rm_rf('spec/dummy/app/compiled_views')
    end

    it "writes precompiles the overrides" do

      filename = 'spec/dummy/app/compiled_views/posts/precompileme.html.erb'

      File.exists?(filename).should be_true

      file = File.open(filename, "rb")
      contents = file.read

      contents.should =~ /precompile/
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

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