Sha256: f2bd79e8fae5d44ff7a758ee88d6858ee3ca1f88142465da2529c1a60adf7add

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe 'ChiliGenerator' do
  describe 'rails g chili EXTENSION_NAME' do
    let(:app_path) { File.expand_path("../../../dummy/example", __FILE__) }
    let(:template_path) { File.expand_path("../../../dummy/template", __FILE__) }

    before do
      FileUtils.rm_rf File.join(app_path, 'vendor/chili_template')
      FileUtils.rm_rf File.join(app_path, 'Gemfile')
      FileUtils.touch File.join(app_path, 'Gemfile')
    end

    it 'creates a new extension with a correct file structure' do
      puts `cd #{app_path} && rails g chili template`

      Dir.glob(File.join(template_path, "**/*")).reject { |f| File.directory?(f) }.each do |template|
        result = File.join(app_path, 'vendor/chili_template', template.sub(template_path, ''))
        result_text = File.open(result, 'rb').read
        template_text = File.open(template, 'rb').read
        template_text.sub!('GIT_AUTHOR',`git config user.name`.chomp) # Git author is be different on each machine
        template_text.sub!('GIT_EMAIL',`git config user.email`.chomp) # Git email is be different on each machine
        result_text.should == template_text
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chili-0.3.0 spec/generators/chili/chili_generator_spec.rb