Sha256: 9d25605de5c9dd09020dc105400c97fbbd7773dcdfb859e5eac946eadbdd7aa0

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'generators/demo/demo_generator'

describe 'model_generator' do
  include RSpec::Rails::Model
  include RSpec::Rails::Model::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.camelize 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.2.0 spec/rspec_for_generators/rspec_for_generators_spec.rb