Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Exposed sprockets_environment from Jasmine::Headless #152

Open
wants to merge 1 commit into from

1 participant

Marcus Mateus
Marcus Mateus
  • Allows for manipulation of the Sprockets::Environment for things like adding/removing pre/postprocessors from within spec_helper.rb (more flexibility than just registering engines).
  • Also, fixed specs that were failing on files_list.rb whenrun standalone due to missing require in file_checker.rb
Marcus Mateus marcusmateus Exposed sprockets_environment from Jasmine::Headless
 * Allows for manipulation of the Sprockets::Environment for
    things like adding/removing pre/postprocessors from spec_helper.rb
 * Also, fixed specs that were failing on files_list.rb when
    run standalone due to missing require in file_checker.rb
0987d6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 13, 2012
  1. Marcus Mateus

    Exposed sprockets_environment from Jasmine::Headless

    marcusmateus authored
     * Allows for manipulation of the Sprockets::Environment for
        things like adding/removing pre/postprocessors from spec_helper.rb
     * Also, fixed specs that were failing on files_list.rb when
        run standalone due to missing require in file_checker.rb
This page is out of date. Refresh to see the latest.
2  Gemfile
View
@@ -23,7 +23,7 @@ gem 'mocha'
gem 'cucumber'
-gem 'jquery-rails', '~> 1.0.0'
+gem 'jquery-rails', '> 1.0'
gem 'ejs'
gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git'
2  lib/jasmine/headless/file_checker.rb
View
@@ -1,3 +1,5 @@
+require 'rainbow'
+
module Jasmine::Headless::FileChecker
def excluded_formats
::Jasmine::Headless::EXCLUDED_FORMATS
10 lib/jasmine/headless/files_list.rb
View
@@ -39,6 +39,10 @@ def reset!
@sprockets_environment = nil
end
+ def sprockets_environment
+ @sprockets_environment ||= Sprockets::Environment.new
+ end
+
def registered_engines
@registered_engines ||= {}
end
@@ -138,7 +142,7 @@ def search_paths
def sprockets_environment
return @sprockets_environment if @sprockets_environment
- @sprockets_environment = Sprockets::Environment.new
+ @sprockets_environment = self.class.sprockets_environment #|| Sprockets::Environment.new
search_paths.each { |path| @sprockets_environment.append_path(path) }
@sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
@@ -326,6 +330,10 @@ def spec_helper
module Jasmine::Headless
extend self
+ def sprockets_environment
+ Jasmine::Headless::FilesList.sprockets_environment
+ end
+
def register_engine(file_extension, template_class)
Jasmine::Headless::FilesList.register_engine(file_extension, template_class)
end
14 spec/lib/jasmine/headless/files_list_spec.rb
View
@@ -189,6 +189,20 @@
end
end
+
+ describe "#sprockets_environment" do
+
+ before(:each) do
+ Jasmine::Headless::FilesList.reset!
+ end
+
+ it "should return shared class-level sprockets environment that will be used when tests are run" do
+ processor = Object.new
+ described_class.sprockets_environment.register_postprocessor "application/javascript", processor
+ described_class.new.sprockets_environment.postprocessors["application/javascript"].should include(processor)
+ end
+
+ end
end
end
Something went wrong with that request. Please try again.