Permalink
Browse files

added generator specs using the ammeter gem

  • Loading branch information...
1 parent 475a8d1 commit 16e8868da1abfbf656c040c3eeb6fe405b390953 @alexrothenberg alexrothenberg committed Oct 6, 2011
Showing with 35 additions and 3 deletions.
  1. +2 −1 .gitignore
  2. +2 −1 Gemfile
  3. +28 −0 spec/generators/draper/decorator/decorator_generator_spec.rb
  4. +3 −1 spec/spec_helper.rb
View
@@ -5,4 +5,5 @@ Gemfile.lock
pkg/*
coverage.data
coverage/*
-.yardoc
+.yardoc
+tmp
View
@@ -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'
@@ -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
@@ -5,4 +5,6 @@
require './spec/samples/application_helper.rb'
Dir.glob(['./spec/samples/*.rb', './spec/support/*.rb']) do |file|
require file
-end
+end
+
+require 'ammeter/init'

0 comments on commit 16e8868

Please sign in to comment.