Skip to content

Commit 16e8868

Browse files
added generator specs using the ammeter gem
1 parent 475a8d1 commit 16e8868

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Gemfile.lock
55
pkg/*
66
coverage.data
77
coverage/*
8-
.yardoc
8+
.yardoc
9+
tmp

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
source :rubygems
22

33
gem 'rake'
4-
gem 'rspec', '~> 2.0.1'
4+
gem 'rspec', '~> 2.0'
55
gem 'activesupport', '~> 3.0.10'
66
gem 'actionpack', "~> 3.0.10", :require => 'action_view'
7+
gem 'ammeter', '~> 0.1.3'
78
gem 'guard'
89
gem 'guard-rspec'
910
gem 'launchy'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'spec_helper'
2+
3+
# Generators are not automatically loaded by Rails
4+
require 'generators/draper/decorator/decorator_generator'
5+
6+
describe Draper::DecoratorGenerator do
7+
# Tell the generator where to put its output (what it thinks of as Rails.root)
8+
destination File.expand_path("../../../../../tmp", __FILE__)
9+
10+
before { prepare_destination }
11+
12+
describe 'no arguments' do
13+
before { run_generator %w(products) }
14+
15+
describe 'app/decorators/application_decorator.rb' do
16+
subject { file('app/decorators/application_decorator.rb') }
17+
it { should exist }
18+
it { should contain "class ApplicationDecorator < Draper::Base" }
19+
end
20+
21+
describe 'app/decorators/products_decorator.rb' do
22+
subject { file('app/decorators/products_decorator.rb') }
23+
it { should exist }
24+
it { should contain "class ProductsDecorator < ApplicationDecorator" }
25+
end
26+
27+
end
28+
end

spec/spec_helper.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
require './spec/samples/application_helper.rb'
66
Dir.glob(['./spec/samples/*.rb', './spec/support/*.rb']) do |file|
77
require file
8-
end
8+
end
9+
10+
require 'ammeter/init'

0 commit comments

Comments
 (0)