Sha256: b697f6329ba9feddd20d397f28d12e77274dbe2c04931321760f783abbd16a6f

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)
module Noe
  describe "Template::Entry#relocate" do
    
    let(:template){ 
      Template.new(File.expand_path('../../../../../templates/ruby', __FILE__)) 
    }
    let(:vars){ 
      {"lower" => "project"} 
    }
    subject{ 
      entry.relocate(vars) 
    }
    
    describe "when nothing has to change" do
      let(:entry){ template.entry('.gitignore') }
      it{ should == ".gitignore" }
    end

    describe "when exactly a replacement" do
      let(:entry){ template.entry("__lower__") }
      it { should == "project" }
    end
    
    describe "when a replacement inside something else" do
      let(:entry){ template.entry("__lower___spec.rb") }
      it { should == "project_spec.rb" }
    end
    
    describe "when no replace and sub file" do
      let(:entry){ template.entry("lib", "README.md") }
      it { should == ["lib", "README.md"].join(File::PATH_SEPARATOR)  }
    end
    
    describe "when no replace and sub file with replacement" do
      let(:entry){ template.entry("lib", "__lower__.rb") }
      it { should == ["lib", "project.rb"].join(File::PATH_SEPARATOR)  }
    end

  end 
end # module Noe

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
noe-1.7.3 spec/unit/template/entry/relocate_spec.rb
noe-1.7.2 spec/unit/template/entry/relocate_spec.rb
noe-1.7.1 spec/unit/template/entry/relocate_spec.rb
noe-1.7.0 spec/unit/template/entry/relocate_spec.rb
noe-1.6.0 spec/unit/template/entry/relocate_spec.rb
noe-1.5.1 spec/unit/template/entry/relocate_spec.rb
noe-1.5.0 spec/unit/template/entry/relocate_spec.rb
noe-1.4.0 spec/unit/template/entry/relocate_spec.rb