Sha256: 19df6c7c6e8c8e5649c8c9ff86e8645b650364f076064371d3a7caa7c27dd984

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

CLASS = RailsAssist::Directory

class RailsDir
  extend RailsAssist::UseMacro
  use_helper :directory
end

def rails_root
  RailsAssist::Directory.rails_root
end

describe RailsAssist::Directory do
  # use_helper :directories

  before do
    RailsAssist::Directory.rails_root = fixtures_dir
    @test = RailsDir.new
  end

  RailsAssist::Directory::Root.root_directories.each do |name|
    eval %{
      describe '##{name}_dir' do
        it "should return #{name} directory name" do
          CLASS.#{name}_dir.path.should match /\/\#{name}/
          CLASS.#{name}_dir.path.should match Regexp.escape(RailsAssist::Directory.rails_root)
          @test.#{name}_dir.path.should match /\/\#{name}/
        end
      end
    } 
  end
    
  describe '#rails_dir_for' do
    it "should return mailer directory name" do
      @test.rails_dir_for(:mailer).path.should == File.join(rails_root, 'app', 'mailers')
    end
  end

  describe '#rails_dir_for' do
    it "should return app directory name" do
      @test.rails_dir_for(:app).path.should == File.join(rails_root, 'app')
    end
  end

  describe '#config_dir_for' do
    it "should return initializers directory name" do
      @test.config_dir_for(:initializer).path.should == File.join(rails_root, 'config', 'initializers')
    end
  end
  
  describe '#self.config_dir_for' do
    it "should return initializers directory name" do
      CLASS.config_dir_for(:initializer).path.should == File.join(rails_root, 'config', 'initializers')
    end
  end

  describe '#public_dir_for' do
    it "should return javascripts directory name" do
      @test.public_dir_for(:javascript).path.should == File.join(rails_root, 'public', 'javascripts')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_assist-0.5.3 spec/rails_assist/directory_spec.rb
rails_assist-0.5.2 spec/rails_assist/directory_spec.rb
rails_assist-0.5.1 spec/rails_assist/directory_spec.rb
rails_assist-0.5.0 spec/rails_assist/directory_spec.rb
rails_assist-0.4.4 spec/rails_assist/directory_spec.rb
rails_assist-0.4.3 spec/rails_assist/directory_spec.rb
rails_assist-0.4.2 spec/rails_assist/directory_spec.rb
rails_assist-0.4.1 spec/rails_assist/directory_spec.rb
rails_assist-0.4.0 spec/rails_assist/directory_spec.rb