Sha256: 4590380076a49db01eb7510658da298a322e830845e3ba2b1f28d9f22f8278f9

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

CLASS = Rails3::Assist::File

class AppDir
  extend Rails3::Assist::UseMacro
  use_helper :file
end

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

  before do
    Rails3::Assist::Directory.rails_root = fixtures_dir
  end

  describe '#initializer_file' do
    it "should return the initializer file 'mime_type' " do
      AppDir.new.initializer_file('mime_type').should match /mime_type/
    end
  end    

  describe '#create_initializer' do
    it "should create the initializer file 'my_init' " do
      name = 'my_init'
      CLASS.create_initializer(name) do
        'hello'
      end
      CLASS.initializer_file(name).should match /#{name}/
    end
  end    

  describe '#create_javascript' do
    it "should create the javascript file 'my_init' " do
      name = :effects
      CLASS.create_javascript(name) do
        'hello'
      end
      CLASS.javascript_file(name).should match /#{name}/
    end
  end    


  describe '#remove_initializers' do
    before do         
      name = 'my_init' 
      CLASS.create_initializer(name) do
        'hello'
      end
    end
    
    it "should remove the initializer files named 'my_init' " do
      name = 'my_init'
      File.exist?(CLASS.initializer_file(name)).should be_true
      CLASS.remove_initializers(name)
      File.exist?(CLASS.initializer_file(name)).should be_false
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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