Permalink
Browse files

Copying over HAML's testing framework, despite being broken

  • Loading branch information...
1 parent 339311b commit 6aaff8a18fe94dec19db771af58c6c95c3dae1cd Kurtis Rainbolt-Greene committed Jan 29, 2012
View
@@ -1,2 +1,58 @@
TestApp.routes.draw do |map|
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get :short
+ # post :toggle
+ # end
+ #
+ # collection do
+ # get :sold
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get :recent, :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome#index"
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id(.:format)))'
end
@@ -11,7 +11,7 @@ class Slim::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
test "should invoke template engine" do
run_generator
- assert_file "app/views/account/foo.html.slim", %r(app/views/account/foo\.html\.slim)
- assert_file "app/views/account/bar.html.slim", %r(app/views/account/bar\.html\.slim)
+ assert_file File.join "app", "views", "account", "foo.html.slim", %r(app/views/account/foo\.html\.slim)
+ assert_file File.join "app", "views", "account", "bar.html.slim", %r(app/views/account/bar\.html\.slim)
end
end
@@ -11,14 +11,14 @@ class Slim::Generators::MailerGeneratorTest < Rails::Generators::TestCase
test "should invoke template engine" do
run_generator
- assert_file "app/views/notifier/foo.text.slim" do |view|
+ assert_file File.join "app", "views", "notifier", "foo.text.slim" do |view|
assert_match %r(app/views/notifier/foo\.text\.slim), view
assert_match /\= @greeting/, view
end
- assert_file "app/views/notifier/bar.text.slim" do |view|
+ assert_file File.join "app", "views", "notifier", "bar.text.slim" do |view|
assert_match %r(app/views/notifier/bar\.text\.slim), view
assert_match /\= @greeting/, view
end
end
-end
+end
@@ -12,15 +12,20 @@ class Slim::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
test "should invoke template engine" do
run_generator
- %w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.slim" }
- assert_no_file "app/views/layouts/product_lines.html.slim"
+ %w(index edit new show _form).each { |view| assert_file File.join "app", "views", "product_lines", "#{view}.html.slim" }
+ assert_no_file File.join "app", "views", "layouts", "product_lines.html.slim"
end
test "should revoke template engine" do
run_generator
run_generator ["product_line"], :behavior => :revoke
- assert_no_file "app/views/product_lines"
- assert_no_file "app/views/layouts/product_lines.html.slim"
+ assert_no_file File.join "app", "views", "product_lines"
+ assert_no_file File.join "app", "views", "layouts", "product_lines.html.slim"
end
-end
+
+ test "should invoke form builder" do
+ run_generator %w(product_line title:string price:integer --template-engine slim --form-builder some-form-builder)
+ assert_no_file File.join "app", "views", "product_lines", "_form.html.slim"
+ end
+end
@@ -1 +1 @@
-require_generators :slim => ['scaffold', 'controller', 'mailer']
+require_generators :slim => ['scaffold', 'controller', 'mailer']

0 comments on commit 6aaff8a

Please sign in to comment.