Sha256: 0f429e551e98c40892d1a4042a078d1f20d3b178a20eebdab8f775f3e937814f

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 KB

Contents

require File.join(File.dirname(__FILE__),'generator_spec_helper')

describe "Generator" do
  appname = 'mynewapp'
  source = 'mysource'
  path = File.expand_path(File.join(File.dirname(__FILE__)))
  
  before(:each) do
    FileUtils.mkdir_p '/tmp'
  end
  
  describe "AppGenerator" do
    it "should complain if no name is specified" do
      lambda {
        Rhoconnect::AppGenerator.new('/tmp',{})
      }.should raise_error(Templater::TooFewArgumentsError)
    end
    
    before(:each) do
      @generator = Rhoconnect::AppGenerator.new('/tmp',{},appname)
    end
    
    it "should create new application files" do
      SecureRandom.should_receive(:hex).with(64).any_number_of_times
      [ 
        'Gemfile',
        'Rakefile',
        "application.rb",
        'config.ru',
        'public',
        'settings/settings.yml',
        'settings/license.key',
        'spec/spec_helper.rb'
      ].each do |template|
        @generator.should create("/tmp/#{appname}/#{template}")
      end
    end
  end
  
  describe "SourceGenerator" do
    it "should complain if no name is specified" do
      lambda {
        Rhoconnect::SourceGenerator.new('/tmp',{})
      }.should raise_error(Templater::TooFewArgumentsError)
    end
    
    before(:each) do
      FileUtils.rm_rf "/tmp/#{appname}"
      @app_generator = Rhoconnect::AppGenerator.new('/tmp',{},appname)
      @app_generator.invoke!
      @generator = Rhoconnect::SourceGenerator.new("/tmp/#{appname}",{},source)
    end
    
    it "should create new source adapter and spec" do
      @generator.should create("/tmp/#{appname}/sources/#{source}.rb")
      @generator.should create("/tmp/#{appname}/spec/sources/#{source}_spec.rb")
    end
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rhoconnect-3.2.0.beta2 spec/generator/generator_spec.rb
rhoconnect-3.2.0.beta1 spec/generator/generator_spec.rb
rhoconnect-3.1.2 spec/generator/generator_spec.rb
rhoconnect-3.1.1 spec/generator/generator_spec.rb
rhoconnect-3.1.0 spec/generator/generator_spec.rb
rhoconnect-3.1.0.beta2 spec/generator/generator_spec.rb
rhoconnect-3.1.0.beta1 spec/generator/generator_spec.rb
rhoconnect-3.0.6 spec/generator/generator_spec.rb
rhoconnect-3.0.5 spec/generator/generator_spec.rb
rhoconnect-3.0.4 spec/generator/generator_spec.rb
rhoconnect-3.0.3 spec/generator/generator_spec.rb
rhoconnect-3.0.2 spec/generator/generator_spec.rb
rhoconnect-3.0.1 spec/generator/generator_spec.rb
rhoconnect-3.0.0 spec/generator/generator_spec.rb
rhoconnect-3.0.0.rc1 spec/generator/generator_spec.rb
rhoconnect-3.0.0.beta3 spec/generator/generator_spec.rb