Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added generator specs using the ammeter gem

  • Loading branch information...
commit 16e8868da1abfbf656c040c3eeb6fe405b390953 1 parent 475a8d1
@alexrothenberg alexrothenberg authored
View
3  .gitignore
@@ -5,4 +5,5 @@ Gemfile.lock
pkg/*
coverage.data
coverage/*
-.yardoc
+.yardoc
+tmp
View
3  Gemfile
@@ -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
28 spec/generators/draper/decorator/decorator_generator_spec.rb
@@ -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
4 spec/spec_helper.rb
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.