Skip to content
Browse files

Add Skim support

  • Loading branch information...
1 parent b340edd commit 735e757fd05aa37233c7b7b4cd71f897107a548d @yury yury committed Apr 14, 2012
View
1 .gitignore
@@ -2,4 +2,5 @@
*.log
.bundle
Gemfile.lock
+tmp/
pkg/*
View
6 lib/role-rails/engine.rb
@@ -3,9 +3,9 @@
module RoleRails
class Engine < ::Rails::Engine
initializer "role-rails.register" do |app|
- if defined?(Slim::Engine)
- Slim::Engine.default_options[:shortcut] ||= {}
- Slim::Engine.default_options[:shortcut].merge!('@' => 'div role')
+ if defined?(Slim::Parser)
+ shortcut = Slim::Parser.default_options[:shortcut] || {}
+ Slim::Parser.default_options[:shortcut] = shortcut.merge('@' => 'div role')
end
end
end
View
21 test/application_controller_test.rb
@@ -1,21 +0,0 @@
-require 'helper'
-
-class ApplicationControllerTest < ActionController::TestCase
- tests ApplicationController
-
- context 'slim engine' do
- should 'setup role attribute' do
- get :index
-
- assert_tag :tag => 'div',
- :attributes => {
- :role => 'implicitly_defined'
- }
-
- assert_tag :tag => 'div',
- :attributes => {
- :role => 'explicitly_defined'
- }
- end
- end
-end
View
2 test/dummy/app/assets/javascripts/application.js
@@ -10,6 +10,4 @@
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
-//= require jquery
-//= require jquery_ujs
//= require_tree .
View
5 test/dummy/app/assets/javascripts/control.jst.skim
@@ -0,0 +1,5 @@
+@implicitly_defined
+ | Implicitly defined div tag
+
+div@explicitly_defined
+ | Explicitly defined div tag
View
2 test/dummy/config/application.rb
@@ -2,7 +2,9 @@
require 'rails/all'
+require 'coffee-script'
require 'slim'
+require 'skim'
require 'role-rails'
Bundler.require
View
1 test/dummy/config/routes.rb
@@ -1,2 +1,3 @@
Dummy::Application.routes.draw do
+ root :to => "application#index"
end
View
23 test/integration/slim_family_engines_test.rb
@@ -0,0 +1,23 @@
+require 'helper'
+
+class SlimFamilyEnginesTest < ActionDispatch::IntegrationTest
+
+ context "skim engine" do
+ should 'setup role attribute' do
+ get("/assets/application.js")
+
+ assert_match /<div role=\\"implicitly_defined\\">/, response.body
+ assert_match /<div role=\\"explicitly_defined\\">/, response.body
+ end
+ end
+
+ context 'slim engine' do
+ should 'setup role attribute' do
+ get "/"
+
+ assert_tag :tag => 'div', :attributes => { :role => 'implicitly_defined' }
+ assert_tag :tag => 'div', :attributes => { :role => 'explicitly_defined' }
+ end
+ end
+
+end

0 comments on commit 735e757

Please sign in to comment.
Something went wrong with that request. Please try again.