mirror of
https://github.com/kbparagua/paloma
synced 2023-03-27 23:21:17 -04:00
Rails generators spec
This commit is contained in:
parent
b0bcff577f
commit
cad99e2ebe
15 changed files with 37 additions and 37 deletions
|
@ -1,10 +1,9 @@
|
|||
require 'spec_helper'
|
||||
require 'generator_helper'
|
||||
|
||||
=begin
|
||||
|
||||
feature ::Rails::Generators::ControllerGenerator, 'generating a rails controller without action' do
|
||||
include GeneratorSpec::TestCase
|
||||
destination TEMP
|
||||
init
|
||||
arguments ['my_controller']
|
||||
|
||||
before do
|
||||
|
@ -17,14 +16,7 @@ feature ::Rails::Generators::ControllerGenerator, 'generating a rails controller
|
|||
destination_root.should have_structure {
|
||||
directory Paloma.destination do
|
||||
directory 'my_controller' do
|
||||
file '_local.js' do
|
||||
contains 'Paloma.my_controller = {'
|
||||
end
|
||||
|
||||
file '_callbacks.js' do
|
||||
contains '//= require ./_local.js'
|
||||
contains '//= require_tree .'
|
||||
end
|
||||
controller_structure 'my_controller'
|
||||
end
|
||||
end
|
||||
}
|
||||
|
@ -33,8 +25,7 @@ end
|
|||
|
||||
|
||||
feature ::Rails::Generators::ControllerGenerator, 'generating a rails controller with actions' do
|
||||
include GeneratorSpec::TestCase
|
||||
destination TEMP
|
||||
init
|
||||
arguments ['my_controller', 'new', 'edit']
|
||||
|
||||
before do
|
||||
|
@ -53,20 +44,11 @@ feature ::Rails::Generators::ControllerGenerator, 'generating a rails controller
|
|||
destination_root.should have_structure {
|
||||
directory Paloma.destination do
|
||||
directory 'my_controller' do
|
||||
file '_local.js' do
|
||||
contains 'Paloma.my_controller = {'
|
||||
end
|
||||
|
||||
file '_callbacks.js' do
|
||||
contains '//= require ./_local.js'
|
||||
contains '//= require_tree .'
|
||||
end
|
||||
|
||||
file 'new.js'
|
||||
file 'edit.js'
|
||||
controller_structure 'my_controller'
|
||||
action_js 'my_controller', 'new'
|
||||
action_js 'my_controller', 'edit'
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
=end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
//= require ./new_controller/_manifest.js
|
|
@ -1 +1,2 @@
|
|||
//= require ./paloma_core.js
|
||||
//= require ./paloma_core.js
|
||||
//= require ./my_controller/_manifest.js
|
|
@ -1,7 +1,7 @@
|
|||
(function(){
|
||||
// Initializes the main container for all filters and skippers for this
|
||||
// specific scope.
|
||||
var filter = new Paloma.FilterScope('existing_namespace/new_controller');
|
||||
var filter = new Paloma.FilterScope('my_controller');
|
||||
|
||||
// The _x object is also available on callbacks.
|
||||
// You can make a variable visible on callbacks by using _x here.
|
|
@ -1,13 +1,13 @@
|
|||
(function(){
|
||||
// Initializes callbacks container for the this specific scope.
|
||||
Paloma.callbacks['existing_namespace/new_controller'] = {};
|
||||
Paloma.callbacks['my_controller'] = {};
|
||||
|
||||
// Initializes locals container for this specific scope.
|
||||
// Define a local by adding property to 'locals'.
|
||||
//
|
||||
// Example:
|
||||
// locals.localMethod = function(){};
|
||||
var locals = Paloma.locals['existing_namespace/new_controller'] = {};
|
||||
var locals = Paloma.locals['my_controller'] = {};
|
||||
|
||||
|
||||
// ~> Start local definitions here and remove this line.
|
||||
|
@ -15,5 +15,5 @@
|
|||
|
||||
// Remove this line if you don't want to inherit locals defined
|
||||
// on parent's _locals.js
|
||||
Paloma.inheritLocals({from : 'existing_namespace', to : 'existing_namespace/new_controller'});
|
||||
Paloma.inheritLocals({from : '/', to : 'my_controller'});
|
||||
})();
|
|
@ -14,10 +14,10 @@
|
|||
//
|
||||
// Example:
|
||||
// _l.localMethod();
|
||||
var _l = _L['existing_namespace/new_controller'];
|
||||
var _l = _L['my_controller'];
|
||||
|
||||
|
||||
Paloma.callbacks['existing_namespace/new_controller']['action1'] = function(params){
|
||||
Paloma.callbacks['my_controller']['edit'] = function(params){
|
||||
// Do something here.
|
||||
};
|
||||
})();
|
|
@ -14,10 +14,10 @@
|
|||
//
|
||||
// Example:
|
||||
// _l.localMethod();
|
||||
var _l = _L['existing_namespace/new_controller'];
|
||||
var _l = _L['my_controller'];
|
||||
|
||||
|
||||
Paloma.callbacks['existing_namespace/new_controller']['action2'] = function(params){
|
||||
Paloma.callbacks['my_controller']['new'] = function(params){
|
||||
// Do something here.
|
||||
};
|
||||
})();
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,7 @@
|
|||
class MyControllerController < ApplicationController
|
||||
def new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module MyControllerHelper
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
<h1>MyController#edit</h1>
|
||||
<p>Find me in app/views/my_controller/edit.html.erb</p>
|
|
@ -0,0 +1,2 @@
|
|||
<h1>MyController#new</h1>
|
||||
<p>Find me in app/views/my_controller/new.html.erb</p>
|
0
spec/test_app/spec/tmp/config/routes.rb
Normal file
0
spec/test_app/spec/tmp/config/routes.rb
Normal file
Loading…
Add table
Add a link
Reference in a new issue