From da4ead8cf2ec917dfee8808aa8798f03e9ee5904 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Tue, 9 Aug 2011 11:12:20 -0700 Subject: [PATCH] test sprockets with custom js_dir --- features/sprockets.feature | 5 +++++ fixtures/sprockets-app/config.rb | 1 + .../source/library/javascripts/sprockets_base.js | 5 +++++ .../source/library/javascripts/sprockets_sub.js | 3 +++ lib/middleman/core_extensions/sprockets.rb | 1 + 5 files changed, 15 insertions(+) create mode 100644 fixtures/sprockets-app/config.rb create mode 100644 fixtures/sprockets-app/source/library/javascripts/sprockets_base.js create mode 100644 fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js diff --git a/features/sprockets.feature b/features/sprockets.feature index 69cbfe63..943fc273 100644 --- a/features/sprockets.feature +++ b/features/sprockets.feature @@ -3,4 +3,9 @@ Feature: Sprockets Scenario: Sprockets require Given the Server is running at "test-app" When I go to "/javascripts/sprockets_base.js" + Then I should see "sprockets_sub_function" + + Scenario: Sprockets require with custom :js_dir + Given the Server is running at "sprockets-app" + When I go to "/library/javascripts/sprockets_base.js" Then I should see "sprockets_sub_function" \ No newline at end of file diff --git a/fixtures/sprockets-app/config.rb b/fixtures/sprockets-app/config.rb new file mode 100644 index 00000000..0e088852 --- /dev/null +++ b/fixtures/sprockets-app/config.rb @@ -0,0 +1 @@ +set :js_dir, "library/javascripts" \ No newline at end of file diff --git a/fixtures/sprockets-app/source/library/javascripts/sprockets_base.js b/fixtures/sprockets-app/source/library/javascripts/sprockets_base.js new file mode 100644 index 00000000..fc657dc0 --- /dev/null +++ b/fixtures/sprockets-app/source/library/javascripts/sprockets_base.js @@ -0,0 +1,5 @@ +//= require "sprockets_sub" + +function base() { + +} \ No newline at end of file diff --git a/fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js b/fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js new file mode 100644 index 00000000..1b27ea83 --- /dev/null +++ b/fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js @@ -0,0 +1,3 @@ +function sprockets_sub_function() { + +} \ No newline at end of file diff --git a/lib/middleman/core_extensions/sprockets.rb b/lib/middleman/core_extensions/sprockets.rb index 5e4219e4..c39f87d6 100644 --- a/lib/middleman/core_extensions/sprockets.rb +++ b/lib/middleman/core_extensions/sprockets.rb @@ -10,6 +10,7 @@ module Middleman::CoreExtensions::Sprockets run JavascriptEnvironment.new(app) end end + # app.map "/#{app.css_dir}" do # run StylesheetEnvironment.new(app) # end