Sha256: f5cb41e493347ea53f9ac293048699e28eff301ee898802f09f8fa007e5b6521

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Merb::Generators::Generator do
  
  describe "#go_up" do
    
    before do
      @generator = Merb::Generators::Generator.new('/tmp', {})
    end
    
    it "should output an empty string for argument 0" do
      @generator.go_up(0).should == ""
    end
    
    it "should output a single '..' for argument 1" do
      @generator.go_up(1).should == "'..'"
    end
    
    it "should concatenate multiple '..' for other arguments" do
      @generator.go_up(3).should == "'..', '..', '..'"
    end
    
  end
  
  describe "#with_modules" do
    
    before do
      @class = Class.new(Merb::Generators::Generator)
      path = File.expand_path('fixtures', File.dirname(__FILE__))
      @class.template(:no_modules) do
        source path / "templates" / "no_modules.test"
        destination path / "results" / "no_modules.test"
      end
      @class.template(:some_modules) do
        source path / "templates" / "some_modules.test"
        destination path / "results" / "some_modules.test"
      end
      @generator = @class.new('/tmp', {})
    end
    
    it "should be correct for no module" do
      @generator.template(:no_modules).should be_identical
    end
    
    it "should be correct for some modulee" do
      @generator.template(:some_modules).should be_identical
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
merb-gen-0.9.4 spec/generator_spec.rb
merb-gen-0.9.5 spec/generator_spec.rb