spec/spec_helper.rb in deface-0.9.1 vs spec/spec_helper.rb in deface-1.0.0.rc1

- old
+ new

@@ -1,17 +1,21 @@ -require 'rubygems' +require 'simplecov' +SimpleCov.start 'rails' require 'rspec' require 'action_view' require 'action_controller' require 'deface' #have to manually require following three for testing purposes require 'deface/action_view_extensions' require 'haml' require 'deface/haml_converter' require 'time' -Haml.init_rails(nil) +if defined?(Haml::Options) + # Haml 3.2 changes the default output format to HTML5 + Haml::Options.defaults[:format] = :xhtml +end RSpec.configure do |config| config.mock_framework = :rspec end @@ -45,10 +49,12 @@ Rails.logger.stub(:warning) Rails.logger.stub(:info) Time.stub :zone => mock('zone') Time.zone.stub(:now).and_return Time.parse('1979-05-25') + + require "haml/template/plugin" end end shared_context "mock Rails.application" do include_context "mock Rails" @@ -56,5 +62,18 @@ before(:each) do Rails.application.config.stub :deface => Deface::Environment.new Rails.application.config.deface.haml_support = true end end + +# Dummy Deface instance for testing actions / applicator +class Dummy + extend Deface::Applicator::ClassMethods + extend Deface::Search::ClassMethods + + attr_reader :parsed_document + + def self.all + Rails.application.config.deface.overrides.all + end +end +