added generator specs using the ammeter gem

This commit is contained in:
Alex Rothenberg 2011-10-06 16:58:04 -04:00
parent 475a8d1da5
commit 16e8868da1
4 changed files with 35 additions and 3 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

@ -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'