Sha256: a8b971c2e10ab41b4624c8bd1379470d6a996e8b03040b822f2f58cf75593300

Contents?: true

Size: 1.69 KB

Versions: 15

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

CLASS = Rails3::Assist::Directory

class RailsDir
  extend Rails3::Assist::UseMacro
  use_helper :directory
end

describe Rails3::Assist::Directory do
  # use_helper :directories

  before do
    Rails3::Assist::Directory.rails_root = File.dirname (__FILE__)
    @test = RailsDir.new
  end

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

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

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rails3_assist-0.3.7 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.6 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.5 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.4 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.3 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.2 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.1 spec/rails3_assist/directory_spec.rb
rails3_assist-0.3.0 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.13 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.12 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.11 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.10 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.9 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.8 spec/rails3_assist/directory_spec.rb
rails3_assist-0.2.7 spec/rails3_assist/directory_spec.rb