Decorators generated via controller generator hooks have singular names
This commit is contained in:
parent
f260f211f2
commit
427d993631
|
@ -5,7 +5,9 @@ require "rails/generators/rails/scaffold_controller/scaffold_controller_generato
|
||||||
module Rails
|
module Rails
|
||||||
module Generators
|
module Generators
|
||||||
class ControllerGenerator
|
class ControllerGenerator
|
||||||
hook_for :decorator, default: true
|
hook_for :decorator, default: true do |generator|
|
||||||
|
invoke generator, [name.singularize]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ScaffoldControllerGenerator
|
class ScaffoldControllerGenerator
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
require 'rails'
|
||||||
|
require 'ammeter/init'
|
||||||
|
require 'generators/controller_override'
|
||||||
|
require 'generators/rails/decorator_generator'
|
||||||
|
|
||||||
|
describe Rails::Generators::ControllerGenerator do
|
||||||
|
destination File.expand_path("../tmp", __FILE__)
|
||||||
|
|
||||||
|
before { prepare_destination }
|
||||||
|
after(:all) { FileUtils.rm_rf destination_root }
|
||||||
|
|
||||||
|
describe "the generated decorator" do
|
||||||
|
subject { file("app/decorators/your_model_decorator.rb") }
|
||||||
|
|
||||||
|
describe "naming" do
|
||||||
|
before { run_generator %w(YourModels) }
|
||||||
|
|
||||||
|
it { should contain "class YourModelDecorator" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue