require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require_generator :model describe 'model_generator' do include RSpec::Rails::Orm::ActiveRecord before :each do setup_generator 'model_generator' do tests ModelGenerator end remove_model 'account' end after :each do remove_model 'account' end it "should not work without an Account model file" do with_generator do |g| name = 'account' g.run_generator [name] g.should_not generate_file name, :model end end it "should decorate an existing Account model file with include Canable:Ables" do with_generator do |g| name = 'account' create_model name g.run_generator [name] g.should generate_model name do |content| content.should have_class name do |klass| klass.should include_module 'Canable::Ables' end end end end end