Sha256: dd1b2e16bfa630bafe22ab93c7d8a2560ac4d5e285413da640cb77f3f6ce54fb

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require_generator :demo

describe 'model_generator' do
  include RSpec::Rails::Orm::ActiveRecord
  
  before :each do              
    RSpec::Generator.setup_generator 'model_generator' do
      tests DemoGenerator
    end    
    remove_model 'account'    
  end

  after :each do              
    remove_model 'account'    
  end
    
  it "should not work without an Account model file" do            
    RSpec::Generator.with_generator do |g|   
      name = 'account'
      g.run_generator %w{account}
      g.should_not generate_file name, :model
    end
  end

  it "should decorate an existing Account model file with include Canable:Ables" do            
    RSpec::Generator.with_generator do |g|  
      name = 'account'
      create_model name     
      g.run_generator %w{account}
      g.should generate_file name, :model do |content|
        content.should have_class name do |klass|
          klass.should include_module 'Canable::Ables'
        end
      end
    end
  end

end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec_for_generators-0.3.0 spec/rspec_for_generators/rspec_for_generators_spec.rb