Permalink
Browse files

Use ammeter instead of aruba to test generators

* Tests are much faster
* Failures are improved
* Don't generate a Rails app inside each test
* Don't boot up Rails several times
  • Loading branch information...
jferris committed Apr 30, 2013
1 parent 223dae6 commit 366ad3571b0fc81f681472eb0ae911f47c60a405
Showing with 42 additions and 62 deletions.
  1. +1 −0 effigy.gemspec
  2. +0 −62 features/rails_generators.feature
  3. +39 −0 spec/generators/effigy/view/view_generator_spec.rb
  4. +2 −0 spec/spec_helper.rb
View
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'nokogiri', '>= 1.3'
s.add_development_dependency 'ammeter'
s.add_development_dependency 'aruba'
s.add_development_dependency 'cucumber'
s.add_development_dependency 'rails', '>= 3.2'

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,39 @@
require 'spec_helper'
require 'generators/effigy/view/view_generator'
describe Effigy::Generators::ViewGenerator do
destination File.join(PROJECT_ROOT, 'tmp')
before { prepare_destination }
it 'generates an action view and template with the given name' do
run_generator %w(users create)
view = file('app/views/users/create.html.effigy')
view.should exist
view.should contain('class UsersCreateView < Effigy::Rails::View')
view.should contain('app/templates/users/create.html')
template = file('app/templates/users/create.html')
template.should exist
template.should contain('UsersCreateView')
template.should contain('Edit me at app/templates/users/create.html')
template.
should contain('Edit my view at app/views/users/create.html.effigy')
end
it 'generates a layout view and template' do
run_generator %w(layouts narrow)
view = file('app/views/layouts/narrow.html.effigy')
view.should exist
view.should contain('class NarrowLayout < Effigy::Rails::View')
view.should contain('app/templates/layouts/narrow.html')
template = file('app/templates/layouts/narrow.html')
template.should exist
template.should contain('NarrowLayout')
template.should contain('Edit me at app/templates/layouts/narrow.html')
template.
should contain('Edit my view at app/views/layouts/narrow.html.effigy')
end
end
View
@@ -1,4 +1,6 @@
require 'rspec'
require 'rails/all'
require 'ammeter/init'
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
RAILS_ROOT = File.join(PROJECT_ROOT, 'tmp', 'rails_root')

0 comments on commit 366ad35

Please sign in to comment.