1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Merge pull request #36 from alexrothenberg/generator_specs

Generator specs
This commit is contained in:
Jeff Casimir 2011-10-07 13:22:21 -07:00
commit 9cb78a616e
5 changed files with 35 additions and 4 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ Gemfile.lock
pkg/*
coverage.data
coverage/*
.yardoc
.yardoc
tmp

View file

@ -1,9 +1,10 @@
source :rubygems
gem 'rake'
gem 'rspec', '~> 2.0.1'
gem 'rspec', '~> 2.0'
gem 'activesupport', '~> 3.0.10'
gem 'actionpack', "~> 3.0.10", :require => 'action_view'
gem 'ammeter', '~> 0.1.3'
gem 'guard'
gem 'guard-rspec'
gem 'launchy'

View file

@ -319,7 +319,6 @@ end
* Add YARD documentation to source
* Add a section about contributing
* Generators
* Test coverage for generators (help!)
* Implement hook so generating a controller/scaffold generates a decorator
* Add generators for...
* `draper:model`: Model + Decorator

View file

@ -0,0 +1,28 @@
require 'spec_helper'
# Generators are not automatically loaded by Rails
require 'generators/draper/decorator/decorator_generator'
describe Draper::DecoratorGenerator do
# Tell the generator where to put its output (what it thinks of as Rails.root)
destination File.expand_path("../../../../../tmp", __FILE__)
before { prepare_destination }
describe 'no arguments' do
before { run_generator %w(products) }
describe 'app/decorators/application_decorator.rb' do
subject { file('app/decorators/application_decorator.rb') }
it { should exist }
it { should contain "class ApplicationDecorator < Draper::Base" }
end
describe 'app/decorators/products_decorator.rb' do
subject { file('app/decorators/products_decorator.rb') }
it { should exist }
it { should contain "class ProductsDecorator < ApplicationDecorator" }
end
end
end

View file

@ -5,4 +5,6 @@ require 'draper'
require './spec/samples/application_helper.rb'
Dir.glob(['./spec/samples/*.rb', './spec/support/*.rb']) do |file|
require file
end
end
require 'ammeter/init'